Preventing IIS time-outs / recycles when debugging your ASP.NET / SharePoint code

If you are developing web applications or SharePoint solutions that are deployed to the front-end you have probably already encountered the following error while you were debugging a long piece of code:

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.

You get this error because there is a mechanism in IIS which detects unresponsive web application and tries to restart them. Basically it works by pinging the applications every X seconds (90 by default) and it no answer is received it will recycle them. To give you more time to debug your code you can either disable it to change it to a larger number. I do not recommend disabling it firstly to have a more production like environment and secondly because it is useful!

How to disable or change it to a longer period

  1. Open IIS Manager and go to “Application Pools” node under your web server.
  2. Right-click on your application pool and select “Advanced Settings…”.
  3. Under “Process Model” you will find “Ping Enabled”, “Ping Maximum Response Time” and “Ping Period”.
  4. To disable it, you need to set “Ping Enabled” to “False” and to buy more time you need to set “Ping Maximum Response Time” to a larger number for example 300 could be enough.
Application Pool Advanced Settings
Application Pool Advanced Settings
Preventing IIS time-outs / recycles when debugging your ASP.NET / SharePoint code