I have a Windows Azure hosted MVC3 application. In the Application_Start, I call all of my bootstrappers that need to run before the application loads and that is working great. One of the bootstrappers that runs, hits up some web service APIs to preload and cache a bunch of data. This process can take 10-15 seconds which is fine because it's in Application_Start and is a one time hit after I deploy and hit up the site myself.
The site isn't launched yet and I've found that once I deploy and click around for a bit everything is fine and really quick, then if I leave the site 开发者_运维技巧alone for 45 mins or so and go back to it, there is a long delay when loading the page. Through logging I've found that the Application_Start is getting fired and I'm having to wait for the site to fire back up and run all my bootstrappers.
My question is, is it normal for an Azure WebRole to "go to sleep" if there is inactivity? And if so, how can I stop that from happening so that my lucky user that accesses the site that time doesn't have a long wait time and bad experience.
By default, IIS has a 20-minute timeout on idle applications before it unloads them. Consider using a startup task to disable this timeout: http://blog.smarx.com/posts/controlling-application-pool-idle-timeouts-in-windows-azure.
精彩评论