Debug Mode in ASP.NET Applications


Enabling debug mode will negatively affect performance of ASP.NET applications. The following items all can contribute to the slower performance:
  1. Code will execute slower due to additional debug paths being enabled.
  2. Compilation will take longer because additional debug information is being generated, such as symbol (.pdb) files.
  3. Execution timeout is extended to 30,000,000 seconds.
  4. Scripts and images downloaded from the WebResource.axd and ScriptResource.axd handlers are not cached.
  5. Code optimization is disabled.
  6. In .NET Framework 1.1, batch compilation is disabled.
  7. In .NET Framework 1.1, memory usage is significantly increased*.

It is recommended that debug mode is always disabled in a production environment.

* In .NET Framework 1.1, you may notice a substantial increase in usage of virtual bytes by a native heap called “execHeapHandle.” This heap is used when debug mode is enabled and its increased usage of virtual address space will lead to fragmentation of a process's address space, even to the point of encountering a System.OutOfMemoryException.

More Information

Debug mode is enabled by setting the debug attribute of the compilation section to true in the web.config file:

        <compilation debug="true">

It is important to remember that the setting, if not defined in application's web.config file, can be inherited from the parent application's web.config or web.config file located in the.NET Framework's CONFIG folder.

NOTE: Setting the retail attribute of the deployment element to true will cause debugging to be disabled for all applications. However, even with the retail attribute set to true, execution timeout will still be 30,000,000 seconds if debug attribute is set to true.