Microsoft has released a new module for IIS 7.5 which provides the ability to ‘warm-up’ an application and provide a ‘pretty’ page to the end-user until the application is fully loaded and ready to serve content. It is difficult to determine that this module has been installed without checking your Programs and Features or Web Platform Installer. This post will explain how to implement this functionality on IIS 7.5. For this walk-through, I used Windows Server 2008 R2, IIS 7.5 and .Net 4.0. This module is not compatible with IIS 7.

You can install the Application Initialization module using Web Platform Installer, WPI, or directly downloading the correct architecture version from here: Application Initialization for IIS 7.5

This is a two-step feature implementation. The first step is to create an application pool that will automatically ‘spin up’ when IIS starts. This ensures that the application pool, or worker process, that is assigned to the website or application is available and ready to begin processing requests on the first request for the content rather than having the delayed response while the worker process is ‘spun up’ by IIS. You can create this application pool manually if you would like. For this demonstration, I named the application pool ‘WarmUp’ and configured it to use .Net 4.0 as the framework version.

Once you have created the application pool, there is a setting that has to be enabled in the applicationhost.config file which contains all of the top level configuration settings that IIS uses. This file is located at c:\windows\system32\inetsvr\config on a standard install of IIS. I recommend making a backup of this file before continuing. You can use any text editor to update this file. Search for and locate the section named <applicationPools>. Within this section, you will see your application listed in this format:

<add name=”WarmUp” managedRuntimeVersion=”v4.0″ />

This line needs to be updated to contain the startMode option. After editing the line, it should look like this:

<add name=”WarmUp” startMode=”AlwaysRunning” managedRuntimeVersion=”v4.0″ />

Save this file and perform an IISReset so that the change is read into the running memory of the IIS server.

Once this change is made, the w3wp.exe process running under the User Name WarmUp will automatically load into memory. To watch this occur, open Windows Task Manager and sort the Image column until you see w3wp.exe listed and then run the IISReset command again. You will see the application pool disappear when IIS is stopped and then will start back up when IIS starts.

The second step in this process is to assign this application pool to an application so that you can take advantage of this functionality. For this demonstration, I also named my application WarmUp and assigned it to the WarmUp application pool. Once I had done this, I needed to make one last modification to the applicationhost.config file. The preloadEnabled=”true” argument needs to be added within the WarmUp application settings in the <Sites> section of this file as per the example below:

<application path=”/WarmUp” applicationPool=”WarmUp” preloadEnabled=”true”>
<virtualDirectory path=”/” physicalPath=”C:\inetpub\wwwroot\WarmUp” />
</application>

I used a pretty simple default.aspx page that simply loads an image – penguins.jpg.  For the WarmUp page, which is actually the page that is displayed while the application pool is loading after initial restart of IIS, I created a simple warmup.htm page that references a different image – jellyfish.jpg. My application is setup where default.aspx is the default page so I created a single URL rewrite rule to determine the status of the application using the (APP_WARMING_UP} condition to determine if the default.aspx page is displayed or if the warmup.htm page is displayed initially to the client. Here is the actual rule that I used to set this up.

<rule name=”Home Page” stopProcessing=”true”>
<match url=”^$” />
<conditions>
<add input=”{APP_WARMING_UP}” pattern=”1″ />
</conditions>
<action type=”Rewrite” url=”WarmUp.htm” />
</rule>

This is a really excellent module to ensure that your clients do not get a timeout error or experience major latency when first accessing your site after a server reboot or IISReset. You can make your initial page as complex or as eye appealing as you would like in order to help guarantee that your customers do not go elsewhere due to your page not being available at the moment they wanted it.


If you’re interested in receiving support that functions as a part of your team for your Windows Cloud Hosting needs, we would love to discuss ways to create custom solutions for your hosting needs. Give us a call at 1-855-780-0955, or email us at Sales@sherweb.com.

 
Try Performance Cloud Servers

Written by Terri Donahue Employee @ SherWeb

Terri is a System Administrator that has been supporting IIS since version 4.0. Through the years she has had extensive hands-on experience with many web servers including Lotus Domino, Apache, and of course, IIS. She has a passion for helping people solve technology related problems. In addition, she's an active member of the Charlotte PowerShell User Group. She was originally awarded Microsoft MVP for IIS in 2013 and was recently re-awarded on July 1st, 2014.