Oct 03

IIS 8: application initialization with static content

Posted in IIS      Comments Off on IIS 8: application initialization with static content

IIS 8 introduces a new feature known as application initialization which allows you to present static content (ex.: an HTML page) while the application is completing its initialization tasks. In other words, with IIS 8, you can set an HTML page which is returned to the user while the application is “warming up”.

To use this feature in IIS 8, we need to make sure that the Application Initialization option is installed.


After insuring that, we need to configure the site’s application pool so that it gets started before IIS receives the first request for that site. In order to do that, we can fire up the application pool’s advanced property dialog and change its start mode property so that the AlwaysRunning option is set.


Now, we need to update the site’s preload behavior by changing the value of its Preload enabled property to true:


Now that the warming up is set up, we can still take this a little further and specify some static content which will be shown to the unlucky user that hits the site before it ends up its initialization tasks. To do that, we need to add the applitationInitialization element to the system.web section:

<applicationInitialization remapManagedRequestsTo="warmingup.html" skipManagedModules="true">
<add initializationPage="/default.aspx" />

With the previous entry, we’re saying that while the application is being initialized, IIS should return the contents of the warmingup.html file back to any client that tries to access the site. If the user sees this static page, he’ll be redirected to the default.aspx page when the warm up ends.  Notice that we can only serve static content during this phase (you can’t return an ASP.NET page because the app is still being initialized!).

And that’s it for now. Stay tuned for more.