Important alert: (current site time 7/15/2013 9:59:44 PM EDT)
 

article

Kill IIS process without rebooting

Email
Submitted on: 4/10/2002 7:21:19 AM
By: Networking.be  
Level: Beginner
User Rating: By 15 Users
Compatibility: ASP (Active Server Pages)
Views: 55000
(About the author)
 
     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!

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				


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 16 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
4/11/2002 2:28:00 AMCesare

Man, I was looking for this.
Have I ever told you that you're really GREAT ?!?

Have a nive day, you LampedGuru //:wink

Cesare Imperiali
(If this comment was disrespectful, please report it.)

 
4/11/2002 3:42:52 AMCakkie

Cesare, have you ever ... never mind :wink
(If this comment was disrespectful, please report it.)

 
4/11/2002 7:28:06 AMJoshua

Now, if only this little trick worked for NT4....

This only works for Win2000.

(If this comment was disrespectful, please report it.)

 
4/11/2002 1:03:59 PMCakkie

Well, this can be done using NET STOP on NT. I don't know the exact syntax however.
(If this comment was disrespectful, please report it.)

 
4/13/2002 12:27:46 PMPingo

Excellent!
I have to restart IIS very often due to some problems,
so this is really very useful for me.
Thanks.
(If this comment was disrespectful, please report it.)

 
4/24/2002 5:28:20 AMMike

Cool, I didn't know about this. I always used NET STOP but somtimes it takes a long time or doesn't stop the process correctly. I'll give this one a shot the next time dllhost.exe maxes out.
(If this comment was disrespectful, please report it.)

 
5/3/2002 1:01:39 PMMarc

use this on NT4/IIS4:
net stop iisadmin /y
mtxstop
net start w3svc
(also works on w2k but iisreset is prefered)
(If this comment was disrespectful, please report it.)

 
6/19/2002 4:39:05 AMTryfon

Hi, I was doing a google search and came across this tip, but the following page put this tip in context highlighting a potential issue with not updating the metabase:-

http://www.iisanswers.com/articles/IISReset.htm
(If this comment was disrespectful, please report it.)

 
6/19/2002 4:40:47 AMTryfon

URL again:- IISReset issue
(If this comment was disrespectful, please report it.)

 
6/19/2002 4:45:45 AMTryfon (again)

Sorry, the URL keeps coming out wrong.

Do a google search on : "rebooting IIS 5" and you will see this page's tip come first. Go 5 down and see the article from iisanswers.com about the metabase. This is a very important issue to me, and I am determined for people to put this tip in proper context.

Best wishes
Tryfon
(If this comment was disrespectful, please report it.)

 
6/20/2002 3:14:40 PMCakkie

Tryfon, I didn't know about that feature, thanxs for letting me know.
(If this comment was disrespectful, please report it.)

 
2/5/2004 12:36:26 PM

Wow, thanks for the tip, saved the day and the server from rebooting. Also to Tryfon for the pointer. Net stop iisadmin /y did not work.
(If this comment was disrespectful, please report it.)

 
11/29/2004 1:16:00 PMFiras S. Assaad

Thanx a lot man

Best Regards
Firas S. Assaad
(If this comment was disrespectful, please report it.)

 
1/12/2008 7:56:53 PMcyrus rynlee

you can even automate this...
(If this comment was disrespectful, please report it.)

 

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.