如何在IIS 7.5上预热ASP.NET MVC应用程序? [英] How to warm up an ASP.NET MVC application on IIS 7.5?

查看:145
本文介绍了如何在IIS 7.5上预热ASP.NET MVC应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想加快在IIS 7.5服务器上托管的ASP.NET MVC应用程序。以前在 http://forums.iis.net/t/1176740.aspx已经有一段时间被删除。



应用程序应该被加热,每当IIS或ASP.NET工作进程由于任何原因重新启动。在预热期间,IIS应该返回一些表示其预热状态的HTTP状态代码或其无法为任何客户端提供服务。



将创建一个可执行文件,导航到必要的页面在网站通过HttpRequests是个好主意?可以从IProcessHostPreloadClient实现触发可执行文件。可以配置IIS,以便它只接受来自localhost的请求,一旦可执行文件完成,它可以切换到所有客户端 - 但是该切换不应该触发IIS重新启动(显然)。



是否可以使用Visual Studio 2010 - Web性能测试来预热应用程序,而不是创建手动可执行文件?任何其他替代方案?



PS:应用程序使用表单验证并使用会话 - 因此维护状态Cookie和其他Cookie很重要。



更新1 - 我们在我们的应用程序中使用.NET Framework 4.0和Entity Framework(数据库第一)。第一次点击EF查询速度很慢。热身背后的原因是让这些第一次击中。我们已经在大多数地方使用编译查询,我们已经为EF实施了预编译视图。模型和应用的大小非常大且复杂。预热需要遍历许多页面,以确保编译和未编译的EF查询在任何最终用户访问应用程序之前至少执行一次。

解决方案

您可以查看后续用于IIS 7.5和ASP.NET 4.0中内置的自动启动功能。


We would like to warm up an ASP.NET MVC application hosted on IIS 7.5 server. The warm up module that used to be available at http://forums.iis.net/t/1176740.aspx has been removed since sometime.

The application should be warmed up everytime IIS or ASP.NET worker-process restarts for any reason. During the warm up period, IIS should return some HTTP status code signifying its warm up state or its inability to serve any clients.

Would creating a executable that navigates through necessary pages in the site via HttpRequests be a good idea? The executable can be triggered from IProcessHostPreloadClient implementation. Is it possible to configure IIS so that it would only accept requests from localhost and once the executable is done, it can switch over to all clients - but that switch should not trigger an IIS restart (obviously).

Is it possible to use an Visual Studio 2010 - Web Performance Test to warm-up an application instead of creating an manual executable? Any other alternatives?

PS: The application uses Forms Authentication and uses sessions - so maintaining state cookie and other cookies is important.

UPDATE 1 - We are using .NET Framework 4.0 and Entity Framework (database first) in our application. The first time hits to EF queries are slow. The reason behind the warm up is to get these first time hits out of the way. We are already using compiled queries at most places and we have implemented pre-compiled views for EF. The size of the model and application is very large and complex. Warm up needs to walk through many pages to ensure that compiled and non-compiled EF queries get executed at-least once before any end user gets access to the application.

解决方案

You may take a look at the following post for the Auto-Start feature built into IIS 7.5 and ASP.NET 4.0.

这篇关于如何在IIS 7.5上预热ASP.NET MVC应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆