I recently implemented Application Initialization in one of our Azure projects to minimize the time it takes for each site to warm up.
I, in fact, implemented almost all the steps described in this blog post .
In the new deployment, it works for all 10 of my sites in IIS. The problem is that when I then try and update this deployment, I get 500 errors for the first 25 requests or so for each site .
Now this is not ideal, because instead of hitting each site once to warm up after deployment, I now have to load each site about 25 times before I can overcome the 500s. They do not stop there, but it seems that they happen sporadically.
If I repeat the image after deployment, this fixes the problem. However, at the cost of downtime, which is not an option.
Any ideas?
I have the following:
Run the task in ServiceDefinition.csdef to enable the application initialization module:
<Task commandLine="enableApplicationInitializationIIS.cmd" executionContext="elevated"></Task>
Then inside this task I:
PKGMGR.EXE /iu:IIS-ApplicationInit
In ServiceConfiguration.csfg, I installed the latest osFamily :
<ServiceConfiguration serviceName="Foo" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2012-10.1.8">
Then, in the Web role, I have the following to enable all the necessary application initialization parameters:
public class WebRole : RoleEntryPoint { public override bool OnStart() { using (var serverManager = new ServerManager()) { foreach (var site in serverManager.Sites) { foreach (var application in site.Applications) { application["preloadEnabled"] = true; } site.ServerAutoStart = true; } serverManager.ApplicationPoolDefaults.ProcessModel.IdleTimeout = new TimeSpan(00, 00, 00); serverManager.ApplicationPoolDefaults.Recycling.PeriodicRestart.Time = new TimeSpan(00, 00, 00); serverManager.ApplicationPoolDefaults["startMode"] = "AlwaysRunning"; foreach (var appPool in serverManager.ApplicationPools) { appPool["startMode"] = "AlwaysRunning"; } serverManager.CommitChanges(); } return true; } }
And finally, each of my sites has the following:
<system.webServer> <applicationInitialization skipManagedModules="true"> <add initializationPage="/" /> </applicationInitialization> </system.webServer>
Not sure what skipManagedModules ?