- Introduction
- Prerequisites
- Create Your Warmup Script Assembly
- Application Pool: Demo Website
- IIS Web Server: Configuration Editor
- system.applicationHost/applicationPools
- system.applicationHost/ServiceAutoStartProviders
- system.applicationHost/Sites
- Application Initialization
- Final Step: Now Run this animal
- Reference
Introduction
I've been working on IIS asp.net warm up thing for quite sometime and I tried all possible ways to get my warm up script working but it failed to initialized and auto start. After spending some time understanding some of the flow and internal mechanism of request flow, we able to crack the solution. This article will somewhat help you find the resolution to most common problem that we may have to tackle when enabling warmp script in IIS. I started looking few articles around IIS7.5 and auto start app pool but hardly find the resource online to give me crisp and clear steps to enable this.The overall intent of this article is to provide the end to end steps and some known issues that one would run into.There is sample demo code one can download to setup warmup thing for your website. I haven't gone to extend to explain why we need IIS asp.net warmup however I covered the most likely configuration settings that would go into running the warm up script.Prerequisites
The Application Initialization feature requires IIS 8.0 to be installed. In addition, the Application Initialization feature within the IIS "Application Development" sub-feature needs to be installed. The following screen shot from the Windows Server 2012 Server Manager UI shows the Application Initialization feature. IIS 8.0 Application Initialization Setup Key Note: Restart server to effect above changes. This initialization plays important role when we have to execute any startup page automatically without users access any web pages. Sometimes warmp up fails to start because there is some setting that needs to be enabled under [code]Create Your Warmup Script Assembly
This warmp script will be executed at the start up of IIS app pool recylce or at time of website initialization. There can be various scenario we can embed in this start up script.Like we can have warm up script for Caching web pages or getting ready canned reports or any heavy task which takes longer time to load.For demo purpose I kept the code setup simple, to just create folder + file. Remember never have such filesystem read write operation withing website virtual directory or website directory it results in application app pool recycle everytime the filewrite operation takes place.
Application Pool: Demo Website
Enable Start Mode="Always running" from OnDemand ModeIIS Web Server: Configuration Editor
Go to Main Application IIS Root. select Configuration Editor. Changing applicationhost.config is much safer through configuration editor than doing it manually.system.applicationHost/applicationPools
Click on collection to proceed. Ensure highlighted property are set as given below in the screenshot.Check AutoStart mode=true
Check StartMode mode=AlwaysRunning
system.applicationHost/ServiceAutoStartProviders
Click on collection to proceed. Ensure highlighted property are set as given below in the screenshot.system.applicationHost/Sites
Click on collection to proceed. Ensure highlighted property are set as given below in the screenshot.Set ServerAutoStart=true
Set preLoadEnabled=true
Set serviceAutoStartEnabled=true
Set serviceAutoStartProvider=PreWarmUpMyCache
Application Initialization
Troubleshooting 1:Ensure your assembly is compiled and exists in bin folder of website.Troubleshooting 2:Worst case even if warmup script not called ,try including default web page access auto initialize.Refer screenshot.
No comments :
Post a Comment