Sometimes an exception causes application pool
to shutdown. I start it manually but the question is how can I automate this behavior in IIS 7.0
(Windows server 2008).

- 29,931
- 42
- 140
- 205
3 Answers
If an application pool dies, the next request for a resource served by that pool will automatically restart it. If, however, you have rapid fail protection enabled on the app pool, and the pool dies more times than the number specified by the maximum failures property within the interval specified by the failure interval property, then you will receive a 503 Service Unavailable message. At this point, you will have to manually restart the app pool.
To work around this, either disable rapid fail protection for the app pool, or try increasing the number of faults within the time period, and then determine the root cause of the exceptions which are terminating the app pool.

- 14,920
- 6
- 55
- 75
-
It doesn't restart on next request. Can you provide a link ? – Xaqron Jan 27 '11 at 08:32
-
@xaqron - Sure, here's a [link](http://www.iis.net/ConfigReference/system.applicationHost/applicationPools/applicationPoolDefaults) to the IIS app pool defaults. Of particular interest is the `startMode` property. The default value is `onDemand` which starts the app pool on the first HTTP request received. Have you tried disabling *Rapid-Fail Protection*? Try that, then ensure that your app pool is started. Does it still die? What IIS-related errors are in your Application and System event logs? – arcain Jan 27 '11 at 15:49
-
@xaqron - The `startMode` property was added to the IIS 7.5 configuration, however if you are running IIS 7, the default behavior for the app pool emulates `startMode = onDemand`, that should be stated in that document I previously linked. – arcain Jan 27 '11 at 16:27
open iis select your website and on right hand side u see Actions
under Browse Web site -> Advanced Setting
select start Automatically to true.

- 2,527
- 5
- 30
- 47
-
That's already true and it's about starting website on IIS start. I need something to monitor `application pools` and start them on failure. – Xaqron Jan 20 '11 at 01:19
I am having a similar problem in Windows Server 2012 Standard and IIS 8. URLs with an ampersand character at the end cause IIS to freak out, and consider them malicious. This causes the App Pool to fail, crashing the website.
What you need to do is watch the Event Viewer for 1309 events. (In the Event ID column) You can set this up using Task Scheduler. When you see the event, you restart the App Pool.
To restart the App Pool, you can use a .vbs script like this:
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='DefaultAppPool'") ' Recycle the application pool. oAppPool.Recycle
Or you could use Powershell if you like that better.
I use a pretty neat C# program that I found here: http://www.west-wind.com/weblog/posts/2012/Oct/02/A-tiny-Utility-to-recycle-an-IIS-Application-Pool
It does a great job, and seems to get around some of the permissions issues that the previous two methods have. I do have to run this script as an admin, though.
Hope this helps. It does not solve the problem, but it will take the heat off until there is a solution to this URL issue.

- 11
- 1