visual-studio 为什么在 IIS7 中调试总是超时?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1421578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:00:51  来源:igfitidea点击:

Why does debugging keep timing out in IIS7?

visual-studiowindows-7iis-7

提问by mrblah

When I am debugging on my Windows 7 IIS7 machine, I get this error during a debug:

当我在 Windows 7 IIS7 机器上调试时,我在调试过程中收到此错误:

The web server process that was being debugged has been terminated by IIS. this can be avoided by configuring application pool setting in IIS. see help for further details.

正在调试的 Web 服务器进程已被 IIS 终止。这可以通过在 IIS 中配置应用程序池设置来避免。有关详细信息,请参阅帮助。

What am I doing wrong?

我究竟做错了什么?

回答by Portman

When you are debugging, IIS will not service any other requests until you are done stepping through your code. That includes the "ping" request that IIS sends to itself. Since IIS doesn't hear back from itself, it decides to shut itself down, which promptly terminates your debugging.

调试时,IIS 不会为任何其他请求提供服务,直到您完成单步调试代码。这包括 IIS 发送给自身的“ping”请求。由于 IIS 没有收到自己的回复,它决定自行关闭,这会立即终止您的调试。

The solution is to increase the Ping Maximum Response Timein the application pool settings from its default value of 90 seconds. Set it to something high enough that will give you enough time to debug your code (like maybe 300 seconds).

解决方案是将应用程序池设置中的Ping 最大响应时间从其默认值 90 秒增加。将其设置为足够高的值,以便您有足够的时间来调试代码(例如 300 秒)。

Microsoft has a long-winded write-up here.

微软在这里写了一篇冗长的文章。



Edit: Others have suggested setting "Ping Enabled" to false. There are several reasons why I prefer to keep it in place, just with a larger interval, but the most important is that you will (most likely) have worker processing pinging enabled on production, and you should strive to develop and debug under a configuration that is as close to production as possible. If you do NOT have ping enabled on production, then by all means disable it locally as well.

编辑:其他人建议将“Ping Enabled”设置为 false。我更喜欢保留它的原因有几个,只是间隔更大,但最重要的是你将(最有可能)在生产中启用工作进程pinging,并且你应该努力在配置下开发和调试这是尽可能接近生产。如果您没有在生产中启用 ping,那么一定要在本地禁用它。

回答by Justin Grant

IIS has a health-checking feature which periodically checks to see if an IIS worker process is hung or otherwise unusuable. If a worker process is stopped in the debugger, it looks unhealthy from the perspective of IIS, and IIS kills it and spins up a new process.

IIS 具有运行状况检查功能,该功能会定期检查 IIS 工作进程是否挂起或以其他方式不可用。如果工作进程在调试器中停止,从 IIS 的角度来看,它看起来不健康,IIS 会杀死它并启动一个新进程。

To change this behavior (on your dev workstation-- don't want to disable this in production!) go to the IIS management tool, select the Application Pools node in the left pane, and right-click on the app pool that your app lives in, and choose "Advanced Settings". From there, in the "process model" section, set "Ping Enabled" to False. You may also want to set the idle timeout to be a very large number.

要更改此行为(在您的开发工作站上——不要在生产中禁用它!)转到 IIS 管理工具,在左窗格中选择应用程序池节点,然后右键单击您的应用程序所在的应用程序池住,然后选择“高级设置”。从那里,在“进程模型”部分中,将“Ping Enabled”设置为 False。您可能还想将空闲超时设置为一个非常大的数字。

See this IIS.NET articlefor more discussion of this issue and a screenshot. See this TechNet articlefor how to set these settings via code/script outside the admin tool.

有关问题的更多讨论和屏幕截图,请参阅此 IIS.NET 文章。有关如何通过管理工具外部的代码/脚本设置这些设置,请参阅此 TechNet 文章

回答by tb.

If you have microsoft's scom running and configured where you work (assuming this is not a for-fun project) and you are able to create a management pack for it or know someone who is, that may help you pinpoint what is causing the issue. I realize its a long shot, but if that does describe your scenario that is what I would do if no other solution is found.

如果您运行了 microsoft 的 scom 并配置了您的工作位置(假设这不是一个有趣的项目),并且您能够为其创建管理包或认识某人,这可能有助于您查明导致问题的原因。我意识到这是一个很长的镜头,但如果这确实描述了您的场景,那么如果找不到其他解决方案,我就会这样做。