How to speed up web application startup

In a application we are doing some files reading or database query on application start, i.e. we are doing some custom work in global.asax at Application_Start method.

So whenever any page requested by any user, loading the application in memory will take time. Users have to wait till respective page load. This will show that application is slow, and users can’t give good feedback about site.

To overcome this start-up issue for web application hosted on IIS7.5, enable a “AutoStart” property in application pool.

This auto start feature allow us to automatically boot up the web application and execute certain amout of critical code and load items in-memory cache.

We can enable it by opening the IIS 7.5 applicationHost.config file (@C:\Windows\System32\inetsrv\config\applicationHost.config) and by adding a startMode=”AlwaysRunning” attribute to the <applicationPools> entry of our web application:

<add name=”MySite” managedRuntimeVersion=”v4.0″ startMode=”AlwaysRunning” />