Keep IIS running 24/7 with Service Protector

How to Keep IIS Running 24/7 with Service Protector

Automatically restart the IIS Windows Service when it crashes or encounters an error serving pages. Schedule a nightly restart, guard against memory leaks and keep your web sites operating smoothly

Microsoft's popular Internet Information Services (IIS) web server provides the foundation for many Windows-based web applications. It is deployed as a Windows Service, as shown here in services.msc:

To protect IIS with Service Protector:

  1. Download and install Service Protector, if necessary.

  2. Start Service Protector.

  3. Select Protector > Add to open the Add Protector window:

    Add Protector

  4. On the General tab:

    • In the Service to protect dropdown, choose the IIS service, named World Wide Web Publishing Service.

      You will notice a green circle on the left if the service is already running, as pictured below.

    IIS Windows Service: General Tab

  5. If you are interested in monitoring IIS and detecting when it returns a 5XX error serving pages (or stops serving pages altogether), click over to the Monitor tab. We'll set up a failure detection script to tell Service Protector when IIS has failed.

    1. Follow these instructions to create the failure detection BAT file. We have called ours check-iis.bat and placed it in the Service Protector folder, C:\Program Files (x86)\ServiceProtector.

    2. Check the Whenever it fails a "sanity check" box and click the "..." button to open the Configure Sanity Check window. Enter the full path to the batch file.

      Change the Every controls to 5 minutes or set it to any value that you find appropriate. More time means less frequent checks (and less load on the server), but it also means that errors can go undetected for a longer period.

      Press the OK button to save your sanity check settings.

    IIS Windows Service: Monitor Tab

  6. Click the Save >> button. In a couple of seconds, an entry for IIS will show up in the Service Protector window. IIS is probably already running but it is not yet being protected by Service Protector (as shown below).

    IIS Windows Service: Created

  7. To start protection, choose Protector > Start "World Wide Web Publishing Service". The shield icon will go to green to indicate that IIS is being protected by Service Protector:

    IIS Windows Service: Running

  8. That's it! Next time your computer boots, IIS will start as normal and Service Protector will begin monitoring IIS to promptly restart it if it fails.

    We encourage you to edit IIS in Service Protector and check out the many other settings that may be appropriate for your environment. For example, send an email when the service fails, restart IIS during the wee hours to keep performance snappy, restart IIS if it hogs the CPU and much more.

Trouble protecting the IIS Windows Service?