Friday, November 23, 2012

IIS 8.0 Application Initialization module

I talked about the application pool ‘auto-start’ feature before. In IIS 8 it is renamed to Application Initialization module. Activating it allows you to enable the following capabilities:
  • Starting a worker process without waiting for a request (AlwaysRunning)
  • Load the application without waiting for a request (preloadEnabled)
  • Show a loading page while the application is starting
To enable these features
  • Set the startMode on the application pool  to AlwaysRunning.
<system.applicationHost>   
 <applicationPools>     
  <add name="DefaultAppPool" autoStart="true" startMode="AlwaysRunning" />   
 </applicationPools> 
</system.applicationHost>

  • Set preloadEnabled to true on the web application.

<system.applicationHost>   
 <sites>     
  <site name="Default Web Site" id="1">       
   <application path="/">         
    <virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />       
   </application>       
   <application name="AppInit" applicationPool="DefaultAppPool" preloadEnabled="true">         
    <virtualDirectory path="/AppInit" physicalPath="c:\inetpub\wwwroot\appinit" />      
    </application>     
  </site>   
 </sites> 
</system.applicationHost>


Changing the startMode to AlwaysRunning will start the application pool and initialize your application the moment your IIS server is (re)started. So users that visit your site don’t have to wait because the worker process is already started.

By setting preloadEnabled to true, it starts loading the application within that worker process without waiting for a request.

More information:

No comments: