If an Azure site’s application pool shuts down due to Rapid Fail Protection is it possible to restart it again automatically?
This question asks pretty much the same question but not related to azure
ASP.NET application pool shutdown problem
Possibly using a WebRole to monitor and some adaption of the code on this page Is it possible to restart IIS on a Azure web role without restarting the process?
var mgr = new ServerManager();
var azurePools = mgr.ApplicationPools.Where(p => Guid.TryParse(p.Name));
azurePools.ToList().ForEach(p => p.Recycle());
You can run the following script from a startup task (make sure you create an elevated background task):
Using WMI it will listen for IIS RFP events. This is done by combining
ExecNotificationQuerywithNextEvent. The call toNextEventwill block until a new event arrives. When this happens, the script waits 30sec and restarts the application pool.Anyways, if RFP kicks in it might be more appropriate to see why your process is crashing over and over again.