Why we need Application initialization ?
Benefits of Application initialization :
- its decreases the first response time by preloading the application
- Can set a static page to increase the user experience while application is initializing
- Provides overlapped process recycling
After installation you have to configure this at two level Either at machine level for an application pool or at application level :
Step 1 :
First you will have to add this startMode="AlwaysRunning" for the application pool you always want running in your applicationhost.config which is at palace C:\Windows\System32\inetsrv\config\applicationHost.config .
<applicationPools> <add name="DefaultAppPool" startMode="AlwaysRunning" managedRuntimeVersion="v4.0" /> </applicationPools>
After that you will have to add the following attribute preloadEnabled="true" in applicationhost.config for an application. PreloadEnable sends fake requests to application when the application pools starts up.
<application path="/Mvcmovie" applicationPool="DefaultAppPool" preloadEnabled="true"> <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\Mvcmovie" /> </application>
After using Step1 and Step2 , whenever the Server/Machine get restart IIS ensures the application pool is running and fake request are being sent to the application .
ASP.NET 4.0 "Auto Start" Feature :A single IIS application worker process can host multiple website , you can specify a particular application to which you want to auto start when the worker process loads.By adding this attribute serviceAutoStartEnabled="true".
<application path="/Mvcmovie" applicationPool="DefaultAppPool" preloadEnabled="true" serviceAutoStartEnabled="true"> <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\Mvcmovie" /> </application>
By using above configuration you will definitely enhance the initial loading time of asp.net applications.
References and further readings :
Thanks For reading this article. :) :)