克服*辅助*初始 ASP.Net 应用程序启动时的编译(?)暂停?

发布于 2024-07-30 14:30:01 字数 238 浏览 1 评论 0原文

将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

走野 2024-08-06 14:30:01

这是 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.

清音悠歌 2024-08-06 14:30:01

保持工作进程处于活动状态的一种常见方法(尽管对我来说看起来很黑客)是让某些程序定期向应用程序中的某些 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.

樱娆 2024-08-06 14:30:01

我确实找到了 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:

  • Recycle Worker Process: Disable. Use this only if you have multiple websites and are trying to isolate processes.
  • Shutdown worker processes after being idle for (time in minutes): Disable unless you are sharing resources on your server. With this setting disabled, your website should not unload, ensuring that startup time for your site is as minimal as possible.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文