Today post will cover about one of IIS 8 new feature. It is called 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

1. Set the startMode on the application pool  to AlwaysRunning.

    <system.applicationHost>    
     <applicationPools>      
      <add name="DefaultAppPool" autoStart="true" startMode="AlwaysRunning" />    
     </applicationPools>  
    </system.applicationHost> 

2. 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.