问题描述
我在 ASP.Net MVC 3 中开发了一个项目,我的主机使用的是 iis7 (Win Web Serv 2008 R2),网站闲置后的第一个请求(大约 1-2 小时)非常慢.
I developed a project in ASP.Net MVC 3, my hosting is using iis7 (Win Web Serv 2008 R2), and the first request after the website sit's idle (during about 1-2 hours) is very slow.
我使用具有 512Mb RAM 的 VPS.这可能与 RAM 太少有关吗?
I use VPS with 512Mb RAM. Can this be related with a too little RAM?
谁能帮我解决这种行为的可能原因?
Can anyone help me with possible causes of such behaviour?
推荐答案
在一定数量的不活动后,IIS 会卸载 AppDomain.然后第一个请求再次加载应用程序,速度较慢.您可以尝试在 IIS 的属性中配置此时间段,但也可能存在应用程序卸载的其他原因,例如达到特定的 CPU 或内存使用阈值.这些阈值也可以在 IIS 中进行配置.
After a certain amount of inactivity IIS unloads the AppDomain. And then the first request loads the application once again which is slower. You could try to configure this period in the properties of IIS but there might also be other causes that an application unloads such as for example a certain threshold of CPU or memory usage is reached. Those thresholds are also configurable in IIS.
这不是 ASP.NET MVC 所特有的.一般而言,所有 ASP.NET 应用程序都是如此.
That's not something specific for ASP.NET MVC. It's true for all ASP.NET applications in general.
这篇关于在网站使用 ASP.NET MVC 3 (IIS7) 闲置后,第一个请求非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!