10.16. Autostart Web Applications

Some ASP.NET applications perform a lot of startup work (usually in Global.asax's Application_Load() method), such as preloading or caching data. ASP.NET 4.0 introduces a new feature called autostart that enables you to define code to be run as soon as your application is installed (or the app pool is recycled). Until this startup work has completed, ASP.NET will prevent access to the application.

Not all applications will be able to benefit from this facility, though, because they must do the following:

  • Be running on Windows Server 2008 R2 and IIS 7.5

  • Be written in ASP.NET 4.0

To use autostart, add the following setting to the applicationHost.config file (at C:\Windows\System32\inetsrv\config\):

<applicationPools> ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.