Why does debugging keep timing out in IIS7?

Visual StudioWindows 7Iis 7

Visual Studio Problem Overview


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

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

What am I doing wrong?

Visual Studio Solutions


Solution 1 - Visual Studio

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.

The solution is to increase the Ping Maximum Response Time in 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).

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.

Solution 2 - Visual Studio

Solution 3 - Visual Studio

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.

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.

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

Solution 4 - Visual Studio

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmrblahView Question on Stackoverflow
Solution 1 - Visual StudioPortmanView Answer on Stackoverflow
Solution 2 - Visual StudioAna BettsView Answer on Stackoverflow
Solution 3 - Visual StudioJustin GrantView Answer on Stackoverflow
Solution 4 - Visual Studiotb.View Answer on Stackoverflow