gpt4 book ai didi

asp.net - 如何确定 ASP.NET 应用程序被回收的原因

转载 作者:行者123 更新时间:2023-12-02 12:19:53 26 4
gpt4 key购买 nike

我正在 IIS7 服务器上运行 ASP.NET 应用程序。它已经运行良好很长时间了,但在过去一周左右的时间里,它每天都会多次丢弃所有用户的 session 。我启用了所有应用程序池回收日志记录选项,如 http://blogs.iis.net/ganekar/archive/2008/12/12/iis-7-0-application-pool-recycles-log-a-event-in-windows-event-log.aspx 中所述。 ,但我的事件日志中没有收到任何内容。

事件日志中没有错误,除了我的所有用户都丢失 session 之外,没有明显的症状。

还有其他原因导致 IIS 回收我的应用程序池吗?我可以启用任何其他类型的日志记录来了解正在发生的情况吗?

最佳答案

当您遇到此行为时,您最近多久将文件部署到服务器?

编译标签上有一个名为 numRecompilesBeforeAppRestart 的令人讨厌的配置选项:

<system.web>
<compilation debug="true" numRecompilesBeforeAppRestart="15">

http://msdn.microsoft.com/en-us/library/system.web.configuration.compilationsection.numrecompilesbeforeapprestart.aspx

该值默认为 15。我之前曾经历过一个应用程序杀死所有用户 session 的情况,这对我来说是罪魁祸首。在更新很少使用的 Web 应用程序后的大约一天(新文件复制到服务器;这最终会覆盖每个文件,数量达到数百个),我们会得到不断的 AppDomain 重新启动,所有用户的所有 session 值都会消失。

我发现这个错误报告列出了我遇到的行为: http://support.microsoft.com/kb/319947

这是与我的场景非常重要的相关文本:

However, this problem occurs when you load many new .aspx or .ascx files to the server (for example, 61 files). The server unloads the application when the first 15 files are recompiled and every time another 15 files are recompiled until the server reaches 61. This results in four application restarts even though only one is required.

我将该值更改为 99999,问题就消失了。这意味着我的工作进程中将积累更多内存,因此我在 IIS AppPool 回收设置中添加了每日回收(当我的网站没有用户时,凌晨 3 点)。

关于asp.net - 如何确定 ASP.NET 应用程序被回收的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2413205/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com