克服*辅助*初始 ASP.Net 应用程序启动时的编译(?)暂停?
将 ASP.Net 应用程序部署到新服务器后,第一个访问该应用程序的用户会长时间停顿,可能是因为该应用程序正在执行其初始编译。 然而,这种暂停似乎也会发生在应用程序超时并从内存中卸载自身之后。
第一次编译是可以容忍的,因为它只发生一次,但在我看来,第二次编译应该是不必要的......有解决方法来解决这个问题吗? 能够延长应用程序超时会很好,但我只看到一种延长会话超时的方法,我宁愿不这样做,因为这会将所有用户会话长时间保留在内存中。
After deploying an ASP.Net application to a new server, the first user to hit the app gets a long pause, presumably because the app is performing its initial compilation. However, this pause seems to also also occur after the application has timed out and unloaded itself from memory.
The first compilation would be tolerable as it only happpens once, but the 2nd one seems to me like it should be unnecessary....is there a workaround to address this issue? It would be nice to be able to extend the application timeout, but I only see a way to extend the session timeout, which I would rather not do, as this would keep all user sessions in memory for a long period of time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是 IIS 关闭工作进程 - 默认空闲时间是 20 分钟。 在 IIS6 中,您可以配置 应用程序池并关闭空闲超时(在“性能”选项卡上)。 在 IIS7 中,位于高级设置中。
That's IIS shutting down the worker process - the default is a 20 min idle time. In IIS6, you can configure the app pool and turn off the Idle timeout (on Performance tab). In IIS7, it's in the Advanced Settings.
保持工作进程处于活动状态的一种常见方法(尽管对我来说看起来很黑客)是让某些程序定期向应用程序中的某些 URL 发出 Web 请求。
您可以通过使用 aspnet_compiler.exe。 这不会将初始请求时间减少到零(它仍然需要创建工作进程并执行其他内务处理。)但它会显着减少它。
A common way (though looks hackish to me) to keep the worker process alive is to have some program issue web requests to some URL in the application on a regular basis.
You can reduce the initial startup time by precompiling the ASP.NET app with aspnet_compiler.exe. This won't reduce the initial request time to zero (it'll still need to create the worker process and do other housekeeping.) but it'll noticeably reduce it.
我确实找到了 IIS 中应用程序池的一些推荐设置。 这些设置的预期结果是减少应用程序需要经历启动周期的次数。 这些设置应适用于 IIS 6 和 IIS 7:
I did find some recommended settings for the App Pools in IIS. The intended outcome of these settings is to reduce the number of times your application needs to go through the startup cycle. These settings should apply to IIS 6 as well as IIS 7: