Kill IIS process without rebooting

Submitted on: 1/6/2015 3:34:00 AM
By: (from psc cd)  
Level: Beginner
User Rating: By 15 Users
Compatibility: ASP (Active Server Pages)
Views: 2723
     Ever had to restart IIS when it was caught up in a loop, or doing some other stuff which results in IIS not coming down. Service manager fails to stop the www service, task manager gets the "Permission denied error". Only way out is a reboot? Not true!


Killing IIS

We've probably all been in an endless-loop situation, or in a situation where your dll called from ASP hangs (every used a msgbox in a dll?).

Bottom line, we need to restart the IIS services. However, because the process is still active, the service manager isn't able to shut it down. When trying to forcefully kill the inetinfo.exe process, or the DLLHOST.EXE process your dll is running in, we get a permission denied error, even when doing this as an administrator. In this case, you probably ended up rebooting the machine...

However, you don't need to. There's a tool from Microsoft, which is installed when installing IIS. It is called iisreset, and can be found in the winnt\system32 folder. This can be run from the command line, and takes a few parameters. The most important are:

/RESTARTStops and starts IIS
/STARTStarts IIS (if stopped)
/STOPStops IIS (if started)
/REBOOTReboots the PC
/REBOOTONERRORReboots the PC if it fails to stop IIS without forcing it
/NOFORCEDo not force it to stop
/TIMEOUT:XAfter X seconds, IIS is forced to stop, unless /NOFORCE was given. If /REBOOTONERROR was given, this will reboot the system.

This can save you a lot of time, since you don't have to reboot the entire system. Very usefull in systems that have a high load, since downtimes are shorter.

I hope this is of use for anyone, it was (and I'm sure it will always be) for me.

Other 11 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.