问题
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!
回答1:
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!
来源:https://stackoverflow.com/questions/15348621/iis-7-5-application-initialization-for-asp-net-web-service-warmup-without-rema