本文介绍了RequestAcquireState 挂在 .NET 4.5.1 IIS8 上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在负载过重或使用 jQuery 的 ajax abort 函数时,我们看到 IIS 中的请求堆积到了无人能连接的地步,整个站点都挂了,迫使回收.

Under heavy load or when using jQuery's ajax abort function, we see requests build up in IIS to the point where no-one can connect and the entire site hangs, forcing a recycle.

一篇 3 年前的类似帖子.NET 4.5 和 IIS 7.5 也有类似问题,但微软表示已在 4.5.1 中修复并发布了 4.5 补丁.

A similar post from 3 years ago had a similar issue with .NET 4.5 and IIS 7.5 but Microsoft have stated this was fixed in 4.5.1 and released a patch for 4.5.

在使用 IIS 8 的 Windows Server 2012R2 上尝试使用 State Server 时出现此问题,在运行 Windows 10 和 IIS10 的开发机器上使用 State Server 时更是如此.该补丁无法安装在任何这些机器上,因为安装程序被 4.5.1 的存在阻止.更改为 In Proc 可以减少问题的发生,但并不能完全解决问题.

This problem on Windows Server 2012R2 using IIS 8 when trying to use State Server and even more so when using State Server on development machines running Windows 10 and IIS10. The patch cannot be installed on any of these machines as the installer is blocked by the presence of 4.5.1. Changing to In Proc reduces the occurrence of the issue but does not solve it completely.

这个今年在 IIS 论坛上的死帖 有一些其他人也有同样的问题,但没有解决方案.我还尝试按照其他地方的建议将 UploadReadAheadSize 设置为 0,但这并没有解决问题.

This dead thread from this year on the IIS forum had a few others with the same issue but with no resolution. I have also tried setting the UploadReadAheadSize to 0 as suggested somewhere else but that did nothing to resolve the problem.

有没有其他人经历过和/或找到了解决方案?任何输入将不胜感激.

Has anyone else experienced and/or found a solution to this? Any input would be greatly appreciated.

推荐答案

我们的问题似乎是由某人实施这篇文章中的建议引起的 我可以从 HTTPModule 访问会话状态吗?.

The problem we had appeared to have been caused by someone implementing the suggestion in this post Can I access session state from an HTTPModule?.

这似乎诱使 SessionStateModule 认为它需要加载 SessionState,即使最终将执行的处理程序没有标记为 IRequiresSessionState 通过暂时将其替换为一个.加载 SessionState 后,处理程序将交换回原始处理程序.我怀疑,但没有证明,如果请求被取消,SessionStateModule 不会释放锁,因为处理程序正在运行"当时没有标有IRequiresSessionState;因此无需清理.

This appears to trick the SessionStateModule into thinking it needs to load SessionState even if the handler that will eventually be executed isn't marked with IRequiresSessionState by temporarily swapping it for one that is. Once SessionState is loaded the handler is swapped back to the original. I suspect, but have not proved, that if the request is cancelled the SessionStateModule is not releasing the locks because the handler "in play" at the time is not marked with IRequiresSessionState; hence there is no clean up to do.

在问题消失之前移除模块并标记不需要IRequiresSessionState的处理程序.

Removing the module and marking the handlers that didn't therefore need IRequiresSessionState before made the problem go away.

这篇关于RequestAcquireState 挂在 .NET 4.5.1 IIS8 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 16:40