How Can We Help?

Automatically Restarting IIS Servers

You are here:
< Back
Automatically Restarting IIS Servers
Last Updated: 22 May 2001
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*** PLEASE NOTE: Link(s), If Provided, May Be Wrapped ***


Occasionally, due to some funky ASP code, your IIS server
may become unresponsive and require restarting in order
to continue serving pages. Usually, when INETINFO becomes
unresponsive, simply stopping the service won't work. You
have to kill it if you want to have any hope of regaining
control...

With the use of a monitoring tool (e.g. ServersAlive) and
a few batch files, you can automatically restart the IIS
services when ever they stop processing HTTP traffic.

Upgrading to VBScript 5.5 or above is generally advisable,
as it will reduce the number of ASP errors that you
experience.  VBScript 5.0 was very buggy...

New to IIS5, is the IISRESET utility, which allows you
to restart various IIS services on local or remote web
servers.


IISRESET INFO

• http://support.microsoft.com/?KBID=202013http://support.microsoft.com/?KBID=250979http://support.microsoft.com/?KBID=266115http://msdn.microsoft.com/library/periodic/period00/ewn0072.htmhttp://msdn.microsoft.com/library/periodic/period01/asp0201.htm


TROUBLESHOOTING RESOURCES

• http://support.microsoft.com/default.aspx?support/IIS/debug.asphttp://support.microsoft.com/?KBID=160360http://www.microsoft.com/TechNet/iis/tools/ixcptmon.asphttp://msdn.microsoft.com/workshop/server/asp/debug.asp


SCRIPTING SAMPLES

The following script will kill and restart the IIS
services (as well as DrWatson or whatever else you
want it to kill):

*** Requires NT4 or higher PLUS Server ResKit ***
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ECHO Killing INETINFO and MTX Processes...
 RKILL /VIEW \\%COMPUTERNAME%
 FOR /F "TOKENS=1-2" %%V IN ('RKILL /VIEW \\%COMPUTERNAME%') DO IF /I "%%V"=="DRWTSN32.EXE" RKILL /KILL \\%COMPUTERNAME% %%W
 FOR /F "TOKENS=1-2" %%V IN ('RKILL /VIEW \\%COMPUTERNAME%') DO IF /I "%%V"=="MTX.EXE" RKILL /KILL \\%COMPUTERNAME% %%W
 FOR /F "TOKENS=1-2" %%V IN ('RKILL /VIEW \\%COMPUTERNAME%') DO IF /I "%%V"=="MDM.EXE" RKILL /KILL \\%COMPUTERNAME% %%W
 FOR /F "TOKENS=1-2" %%V IN ('RKILL /VIEW \\%COMPUTERNAME%') DO IF /I "%%V"=="INETINFO.EXE" RKILL /KILL \\%COMPUTERNAME% %%W
 NET START W3SVC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


PERSONAL NOTES

• With these scripts copied to each Web Server, you can
  use RCMD or any process monitoring tool to quickly
  restart your web services.

• IISRESET is a more effective tool for IIS5