Restart IIS with commands.

Source: Internet
Author: User

The website is inexplicably faulty (we often cannot find it), so we restart the Service (Sometimes it is better to restart the machine ). Let's talk about how you restart the service in iis6.0 today. I thought it was originally operated on a graphical interface. Later I learned how to restart Net start [Stop] W3SVC, and later I learned about iisweb/start [Stop] default website, later I learned that the iisreset/noforce command can also do this, and later I learned that I can use vbs, as shown below:CodeAs shown in:

Set Webserviceobj =   GetObject ( " IIS: // localhost/w3svc " )
Wamusername = Webserviceobj. wamusername
Msgbox Wamusername

Later, I knew that I could use the C # language for control (I didn't actually do it). Maybe there is another way ...... In general, there are only two situations: restarting the service and restarting the website.

Next, let's take a look at the relationship between websites and services. Services are the foundation for website operation. The World Wide Web Publishing Service can run multiple websites, if the World Wide Web Publishing Service is stopped, all websites and ApplicationsProgramThe pool is stopped. For example:
Otherwise, if you manually stop the website or application pool, the World Wide Web Hing service will not be affected. From this simple relationship, we can conclude that a website may encounter problems that are not necessarily service problems, most of the time there is a problem with the program of this website (of course there are cases where a program error is too severe to cause the service to stop), so it is not necessary to restart the service, just restart the website program. Website data (memory data such as cache or static variables instead of database data) may be disordered and may need to be reloaded, at this time, you only need to restart the application pool corresponding to the website. What command can be used to restart the application pool (of course, through the graphic interface )? Currently, I have found only one way to implement vbs, as shown in the following code:

Set Webapppool =   GetObject ( " IIS: // localhost/w3svc/apppools/defaultapppool " )
Webapppool. Stop
Webapppool. Start

End: If you have a better solution, please do not reply ,.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.