Auto Start Website on IIS 7.0 or 7.5

Some time we may need to restart application pools regularly or we may need to restart the system on certain intervals. At that time, the first user to hit the site has to wait while everything is warms up again. It may take some time may be up to 30 to 60 seconds or above. To avoid this lag time for the first user, Microsoft introduced a feature called Application Initialization. It will automatically initialize the application when application pool starts and avoid the time lag for the first user.

In IIS 8 Application Initialization is part of the IIS feature set. But in IIS 7.0 or 7.5 you need to install this feature from here . It requires a system reboot.

Once it installed, you can check the it in IIS.
  1. Open IIS and click or the server node
  2. In the details pane open the Configuration Editor under Management
  3. Inside the editor, check for the section "System.webServer/applicationInitialization" in the Section drop down list in the top. If you find the section, it is installed successfully.

Now IIS is all set but you need to tell which application pools and websites you want to start. Just open 

C:\Windows\System32\inetsrv\config

and open the applicationHost.config file and do the following changes (Make sure to take a backup of the file before you make changes).

1) Applicaton pools Section:
Find the applicationPools node and add startMode="AlwaysRunning" to the application pool which needs to be start automatically.
<add autoStart="true" managedRuntimeVersion="v4.0" name="Jobs" startMode="AlwaysRunning"/>
Check whether it's autoStart property is "true". Otherwise set it to true. If it is not  there or its value is false then will not autoStart.

2) Web site Section:

Go to the sites node and find your site to which you need to start automatically and set preloadEnabled="true".
<application applicationPool="APPLICATION POOL NAME" path="YOUR SITE NAME" preloadEnabled="true">
        <virtualDirectory path="/" physicalPath="YOUR SITE PHYSICAL PATH">
        </virtualDirectory>
</application>
That's it. Now your site will starts automatically.


Gopikrishna

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment