IIS 7 Tip # 5 Run a command when Rapid Fail Protection is triggered.


Rapid-Fail Protection disables application pools if they crash multiple times within in a specified time period. This prevents the failing application pool from getting into a continuous loop of crashing and restarting. This protects other application pools running on the server as repeated failures can consume lot of system resources. When rapid-fail protection kicks in it stops the application pool that is repeatedly crashing and your clients will start getting a 503 – Service Unavailable error. An administrator will have to manually enable the application pool again.


You also have to option to configure an executable to run when ever rapid-fail protection is triggered. For example below I have configured the application pool to restart the IIS service using iisreset.exe … the /rebootonerror will reboot the whole server if iisreset.exe for some reason fails to restart the services.


vijaysk-rapidfailover

<applicationPools>
<
add name=DefaultAppPoolautoStart=true>
<
failure autoShutdownExe=c:\windows\system32\iisreset.exeautoShutdownParams=/rebootonerror/>
</
add>
</applicationPools>

This option is also available on IIS 6.0 but it is not exposed via the IIS manager. You can set is as follows



cscript adsutil.vbs set W3SVC/AppPools/DefaultAppPool/autoshutdownapppoolexe “c:\windows\system32\iisreset.exe”



Bookmark and Share

Comments (4)

  1. Thank you for submitting this cool story – Trackback from DotNetShoutout

  2. Tanju says:

    I tried this and it did not work. So I entered the command from the command prompt (with "run as administrator). The restart attempt failed, so it initiated a reboot. But it reads: "attempting to reboot the server" and then next line "not implemented". Any ideas why the reboot option returns a "not implemented"?

  3. Andy says:

    I'm trying to work on a process to start the app pool after Rapid Failure Protection happens, so I'm to use 'appcmd recycle apppool /apppool.name:string'.  However, I need to test this before putting it into production.  Any ideas for how I cause failures to the app pool so that I can see if the app pool restart happens like I'm hoping?