On IIS 7.5, how do you warm up an ASP.NET MVC application?

asp.net asp.net-mvc-3 entity-framework iis warm-up


An ASP.NET MVC application running on an IIS 7.5 server has to be warmed up. The warm-up module, which was once accessible at http://forums.iis.net/t/1176740.aspx, has been gone for a while.

Every time IIS or an ASP.NET worker process restarts for whatever reason, the application has to be warmed up. IIS should provide a specific HTTP status code indicating its warm-up stage or its inability to serve any clients during this time.

Would it be a good idea to create an executable that uses HttpRequests to travel through the site's essential pages? The IProcessHostPreloadClient implementation may start the program. Is it feasible to set up IIS such that it only accepts requests from localhost and that, once the executable is complete, it may switch to accepting queries from all clients without having to restart IIS? (obviously).

Is it feasible to warm-up an application using a Visual Studio 2010 - Web Performance Test as opposed to making a manual executable? Any further options?

PS: Because the application utilizes sessions and Forms Authentication, preserving state cookies and other cookies is crucial.

UPDATE 1: In our application, we are using the.NET Framework 4.0 and Entity Framework (database first). EF queries take a while to respond the first time. To get these first hits out of the way, the warm-up is necessary. The majority of the time, we already use compiled queries, and we've added pre-compiled views for EF. The size and complexity of the model and application are enormous. To make sure both compiled and non-compiled EF queries are performed at least once before any end user has access to the application, warm up must go through several pages.

9/12/2011 12:44:02 PM

Popular Answer

Microsoft has made a module available that accomplishes all you need it to. By loading the Web apps before to the initial request, the IIS 7.5's Application Initialization Module increases the responsiveness of websites.

Before accepting requests from actual users, IIS may preload a list of Urls that you define. Though I doubt you'll be able to provide a realistic user login experience, is there any chance you might create simulated login-free sites that serve as the same warmup you're after?

The capability of this module to additionally allow overlapping process recycling is the feature I find most interesting. A step-by-step method for enabling overlapping process recycling is included in the Using the IIS 8.0 tutorial.

When IIS notices that an active worker process is being recycled, IIS waits until the new recycled worker process has completed performing all application initialization Urls in the new process before switching active traffic to the new recycled worker process. This makes sure that once an application is online and operating, website visitors won't encounter application initialization pages.

Although it is integrated into IIS 8.0, this IIS Application Initialization module is available for IIS 7.5 download.

9/21/2012 8:18:30 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow