- Install the Application Initialization 1.0 module available from Microsoft here.
- You'll need to edit the applicationHost.config file on your server to enable Application Initialization. To do this, you'll need to open the file at %WINDIR%\System32\inetsrv\config\applicationHost.config in your text editor of choice and make the following changes:
- Find the 'application' element that you wish to enable for Application Initialization, which you can do with an XPath similar to "/configuration/system.applicationHost/sites/site/application" and once found, set the
preloadEnabled="true"
attribute on the XML element. Add the element if it's not already there. - While on the 'application' element, take note of the 'applicationPool' value, because that's the Application Pool in which the application runs. Find the configuration node for that application pool (XPath: /configuration/system.applicationHost/applicationPools) and then set the following attributes on the <add> element for the application pool and its child 'processModel' element:
<add .... startMode="AlwaysRunning">
<processModel ... idleTimeout="0">
- In your application's web.config file, you'll need to add the following elements:
<system.webServer>
<applicationInitialization remapManagedRequestsTo="/InitializationProxyPage.txt" skipManagedModules="true" doAppInitAfterRestart="true">
<add initializationPage="/Services/MyCustomService.svc" hostName="localhost" />
</applicationInitialization>
<directoryBrowse enabled="true" />
</system.webServer>
You'll need to have the "InitializationProxyPage.txt" file in the root of your web application.
4. Enable "Anonymous" authentication in the Authentication panel of your application in IIS. This is necessary so that the warmup page can successfully execute a GET request for your initialization page to kick off the warmup.
5. If you use the system.webServer/security/authorization or system.webServer/security/authentication sections in your web.config to control access to the application, you'll also need to add the following under the /configuration element as a sibling to the system.webServer element:
5. If you use the system.webServer/security/authorization or system.webServer/security/authentication sections in your web.config to control access to the application, you'll also need to add the following under the /configuration element as a sibling to the system.webServer element:
<configuration>
<location path="InitializationProxyPage.txt">
<system.webServer>
<security>
<authorization>
<clear />
<add accessType="Allow" users="*"/>
</authorization>
</security>
</system.webServer>
</location>
</configuration>
This will grant explicit access to the InitializationProxyPage.txt file to all users (including the App Pool Identity user) so that application warmup is guaranteed to have access to that file and can bootstrap your services.
No comments:
Post a Comment