If at first you don't succeed, call it version 1.0

Contact Me

Sarvesh Kushwaha
Email : sarveshkushwaha@outlook.com

Total Pageviews

Powered by Blogger.

Google+ Followers

Sunday, 24 August 2014

Application Initialization in IIS 7.5 and IIS 8


Why we need Application initialization ?

On first HTTP requests asp.net applications both asp.net web forms and asp.net mvc application requires initialization tasks and "warm up" tasks (Startup processing , generating contents) etc.

Application initialization proactively loads and initialize all the dependencies like database connection , compilation of asp.net code and loading of assemblies etc...

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 


How to install Application initialization module :
For IIS 8.0 its a built-in functionality , even though some sub-features you will have to add.
For IIS 7.5 you need to install application initialization module. Dowlonad LINK
Or you can install this module from web platform installer.

Launch Web platform installer > Find "Application Initialization" > Add and Install









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>

Step 2:

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. :) :) 
Reactions:

1 comment:

  1. Its a great news. i think its important for all the ASP.NET MVC Hosting. i am also using ASP.NET MVC Hosting from myASP.NET and now i am going to install it. thanks for share.

    ReplyDelete