Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5 Application Initialization for ASP.NET web service (warmup) without remapping requests

I'm trying to use the IIS 7.5 Application Initialization extension to configure a warmup process for my web application. This is an approach I am taking to minimize slow downs caused by application pool recycling, which is a problem explained well in other questions on Stack Overflow.

What I would like, is to gain the benefits of application initialization, without remapping requests anywhere else.

What I've done so far

I followed the IIS 8 instructions for the basic use case, and it works great! I created a splash page called app_starting.htm and by using this code, it gets displayed while the app initializes:

<applicationInitialization remapManagedRequestsTo="app_starting.htm" skipManagedModules="true" >
    <add initializationPage="/" />
</applicationInitialization>

Why this isn't good

I want to use initialization to speed up requests to a REST-based web service written using ASP.NET MVC. This web service is a backend for several applications. When they make a request to a resource (i.e. /client/1/addresses), they can't handle receiving a splash page instead.

What I've tried

I removed the remapManagedRequestsTo attribute. However, now when I request a resource during initialization, I get a 500 error until initialization is completed. After which, responses go back to normal. The applications which rely on this this service also wouldn't respond well to a 500 error, since initialization should not be an error condition.

What I need

Without performing any remapping, I expect the request behavior to go back to normal. Even if initialization is in progress, other requests to the application should be queued and wait until after initialization has completed.

Is there something I am missing? Can I accomplish this?

Thanks for the help!

like image 963
Jason Avatar asked Mar 11 '13 21:03

Jason


1 Answers

I think I answered my own question. I removed the skipManagedModules attribute and it worked. This code accomplishes application initialization, and during warmup, requests seem to wait for it to complete before being processed:

<applicationInitialization>
    <add initializationPage="/" />
</applicationInitialization>

I couldn't find any documentation for why it behaves this way and don't really understand what skipManagedModules means. If anyone can further explain this, I can mark the explanation as an answer. Thanks!

like image 183
Jason Avatar answered Sep 21 '22 23:09

Jason