New Restart Features in IIS 5.0

By Shant Tchakerian, Program Manager,Internet Information Services Product Development Team,Microsoft Corporation, Ram Papatla, Software Test Engineer,Internet Information Services Product Development Team,Microsoft Corporation

Microsoft Internet Information Services 5.0 (IIS) provides many new features to reliably restart IIS without having to restart the computer. You can now easily restart IIS in one step, from either the command line or the Internet Information Services snap-in. You can also configure IIS to restart periodically using the Windows 2000 Task Scheduler. Furthermore, IIS takes advantage of the Windows 2000 Service Control Manager's functionality to automatically restart IIS, should it terminate unexpectedly.

restar02

Restarting IIS from the Internet Information Services Snap-In

With IIS 5.0, you can now restart the IIS Service from the Internet Information Services snap-in.

  1. Right-click the Computer icon in the contents pane , and select Restart IIS. (The Computer icon should be labeled with the name of the computer you are connected to)

  2. Select Restart Internet Services on machinename, and click OK.

    Bb742502.restar03(en-us,TechNet.10).gif

    Note: A dialogue box will appear displaying the shutdown status. If you would like to force an immediate shutdown, click End Now.

    Bb742502.restar04(en-us,TechNet.10).gif

Restarting IIS from the Command Line

IIS 5.0 ships with the command line tool IISReset, which allows you to restart IIS from the command line. To restart IIS, simply type the following at the command prompt:

**C:\**iisreset [computername] /RESTART

The IISReset feature can be disabled to prevent users from remotely restarting IIS. When IISReset is disabled, IIS cannot be restarted either locally or remotely from either the command line or the Internet Information Services snap-in. IISReset can only be enabled locally. To disable IISReset type, IISRESET /DISABLE at the command prompt. To re-enable IISReset, simply type IISRESET /ENABLE at the command prompt.

IISReset can be configured to automatically reboot the server should IIS take too long to restart due to a critical error. Using this feature, you do not have to manually reboot the server if an unexpected error prevents IIS from automatically restarting. To enable this feature when using IISReset,, type IISRESET /RESTART /REBOOTONERROR at the command prompt. The server will automatically reboot if it takes more than 20 seconds to successfully stop the Internet services. This timeout value can be specified by using the /TIMEOUT flag as follows:

**C:\**iisreset /RESTART /REBOOTONERROR /TIMEOUT:100

This command causes the server to reboot if it takes more than 100 seconds to stop IIS.

If IISReset is not run with any command-line arguments, it stops and restarts the Web services on the local computer. The following table provides a complete list of command-line options that can be found by typing IISRESET /HELP.

COMMAND-LINE ARGUMENTS

DESCRIPTION

/RESTART

Stop and then restart all Internet services.

/START

Start all Internet services.

/STOP

Stop all Internet services.

/REBOOT

Reboot the computer.

/REBOOTONERROR

Reboot the computer if an error occurs when starting, stopping, or restarting Internet services.

/NOFORCE

Do not forcefully terminate Internet services if attempting to stop them gracefully fails.

/TIMEOUT:val

Specify the timeout value https://support.microsoft.com/default.aspx?scid=kb;en-us;202013&sd=tech (in seconds) to wait for a successful stop of Internet services. On expiration of this timeout the computer can be rebooted if the /REBOOTONERROR parameter is specified. The default value is 20s for restart, 60s for stop, and 0s for reboot.

/STATUS

Display the status of all Internet services.

/ENABLE

Enable restarting of Internet Services on the local system.

/DISABLE

Disable restarting of Internet Services on the local system.

Scheduled Restart

You can schedule periodic restarts of IIS by running IISReset from the Windows 2000 Task Scheduler.

To schedule periodic restarts of IIS perform the following steps:

  1. Enter the Control Panel, and double-click the Scheduled Tasks folder.

  2. Double-click Add Scheduled Task. The Scheduled Task Wizard appears.

  3. Click NEXT to advance to the next page, which will ask for an application to schedule.

  4. Click BROWSE, and enter the following path:

    C:\WinNT\System32\iisreset.exe (assuming Windows is installed on the C:\ drive).

  5. Follow the directions in the Scheduled Task Wizard to schedule a time to reset IIS.

Automatically Restart IIS Upon Unexpected Termination

IIS uses the Service Control Manager's functionality to automatically restart IIS if it should terminate unexpectedly. By default, the Service Control Manager runs IISReset during a failure. Users who wish to perform other actions in addition to restarting IIS, upon unexpected termination, may choose to configure the Service Control Manager to run a batch file.

To configure the Service Control Manager to run a custom script or batch file upon unexpected termination of the IIS service, perform the following steps:

  1. Access the IIS Admin Service Properties page in the Service Control Manager

  2. From the Taskbar, click Start, select Programs, select Administrative Tools, and select Services.

  3. In the right pane, double-click IIS Admin Service. The IIS Admin Service Properties page should appear.

  4. Select the Recovery tab.

  5. In Run file, type the path and filename of the file you wish to run, along with any command-line arguments.

    Bb742502.restar01(en-us,TechNet.10).gif

Note: For a list of all services that IIS depends on and all services that depend on IIS, from IIS Admin Service Properties, select the Dependencies tab.

Conclusion

New features in IIS 5.0 allow you to restart IIS from either the command line or IIS snap-in, locally or remotely, manually or automatically, all without having to reboot your server. By using these new features, you will be able to keep your server up and running for longer periods of time. By taking advantage of the various options for restarting IIS you can implement a solution to keep your server running with minimal user intervention. These are just some of the features that make IIS 5.0 a more reliable and manageable Web server.