Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Application Initialization not Firing into ASP.NET Application

Tags:

asp.net

iis

Running on Windows 8, I have enabled the Application Initialization feature of IIS from the Windows Features install options for IIS.

I'm attempting to get an ASP.NET Web app to start up immediately and fire into Application_Start when the Application Pool is restarted. I've followed the instructions from this tutorial, but after setting the values in the ApplicationHost.config, and web.config I see nothing is firing.

Here's what I've set (which seems to match what the article suggests):

 <applicationPools>
        <add name="MPress" autoStart="true"  
             enable32BitAppOnWin64="true" 
    startMode="AlwaysRunning">
            <processModel identityType="LocalSystem" setProfileEnvironment="true" />
 </applicationPools>
 <sites> 
   <site>
    <application path="/MPress.Workflow.WebQueueMessageManager" 
                 applicationPool="MPress" preloadEnabled="true">
                <virtualDirectory path="/" physicalPath="C:\Projects2010\Clients\MPress\MarvelPress.Workflow.WebQueueMessageManager" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:80:" />
            </bindings>
   </site>
</sites>

And then in the local web.config I have:

<system.webServer>
 <applicationInitialization remapManagedRequestsTo="Startup.htm" 
                            skipManagedModules="true" 
                            doAppInitAfterRestart="true">
   <add initializationPage="default.aspx" />
 </applicationInitialization>
</system.webServer>

Other than the doAppInitAfterRestart flag this matches the settings in the above article exactly except pointing at my virtual app and application pool.

It appears that the Application Pool auto load works - if I stop and restart IIS w3wp I see the application pool show in the task list. But using Process Explorer I can see that the EXE hasn't loaded .NET just sitting there. No .NET Runtime dlls are loaded, so it appears that no request has fired.

What really sucks is that there's no real documentation of section and expected values required for each setting. The doAppInitAfterRestart flag is documented nowhere that I could find. I've also left that out with the same results. I'm also not 100% what the syntax for the URL is. The MSDN article points at "/default.aspx" and I tried that too to no avail.

I also turned on Failed Request Tracing in IIS to see if maybe the fake request fails somehow, but nothing shows up in there. It simply looks like Site Level load is not firing when the application pool restarted.

All of the settings mentioned here are also available through the IIS Admin UI in Windows 8 and everything certainly looks correct.

I'm out of ideas on what else to check or what I might be missing. Any ideas appreciated.

like image 262
Rick Strahl Avatar asked Oct 02 '13 08:10

Rick Strahl


People also ask

How do I enable application initialization?

Windows 8 or Windows 8.1 In Control Panel, click Programs and Features, and then click Turn Windows features on or off. Expand Internet Information Services, expand World Wide Web Services, expand Application Development Features, and then select Application Initialization. Click OK.

What is IIS application initialization?

IIS Application Initialization allows website administrators to configure a web application to be pre-loaded as soon as the worker process starts, before the first request arrives. By pre-loading the application, the worker process is able to reduce the time it takes to respond to the first request.

What is IIS preload?

Application preload features in IIS allows applications to automatically start without a request. To implement this functionality you need to set the preloadEnabled property in the applicationHost.config.


Video Answer


2 Answers

After some more spelunking it turns out that although I had installed the Application Initialization feature using the Windows 8 features, the actual module was not added to the globalModules list.

The following was missing and once added everything started working just fine:

<globalModules>
        <add name="ApplicationInitializationModule" image="%windir%\System32\inetsrv\warmup.dll" />
</globalModules>
like image 146
Rick Strahl Avatar answered Nov 15 '22 21:11

Rick Strahl


I faced similar issue but after doing a bit of comparison I found that you need to set Application Pool Managed Pipeline Mode to Integrated. It will not work with Classic Mode

like image 44
Danish Avatar answered Nov 15 '22 21:11

Danish