Help and Support

HOW TO: Disable Debugging for ASP.NET Applications

Article ID:815157
Last Review:March 27, 2007
Revision:2.5
On This Page

SUMMARY

This step-by-step article discusses how to disable debugging for ASP.NET applications.

ASP.NET supports compiling applications in a special debug mode that facilitates developer troubleshooting. Debug mode causes ASP.NET to compile applications with extra information that enables a debugger to closely monitor and control the execution of an application. Applications that are compiled in debug mode execute as expected. However, the performance of the application is affected. To avoid the effect on performance, it is a good idea to enable debugging only when a developer is doing interactive troubleshooting. By default, debugging is disabled, and although debugging is frequently enabled to troubleshoot a problem, it is also frequently not disabled again after the problem is resolved. This article describes how to disable debugging for an ASP.NET application.



Back to the top

Disable Debugging for an ASP.NET Application

To enable debugging, modify either the Web.config file or the Machine.config file, as detailed in the following steps.

Modify the Web.config File

To enable debugging, add the compilation element to the Web.config file of the application. The Web.config file is located in the application directory. To do this, follow these steps:
1.Open the Web.config file in a text editor such as Notepad.exe. Web.config file is typically located in the application directory.
2.In the Web.config file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to true.
3.Modify the debug attribute to false, and then save the Web.config file to disable debugging for that application.

The following code sample shows the compilation element with debug set to false:
<compilation 
    debug="false"
/>
4.Save the Web.config file. The ASP.NET application automatically restarts.

Modify the Machine.config File

You can also enable debugging for all applications on a system by modifying the Machine.config file. To confirm that debugging has not been enabled in the Machine.config file, follow these steps.
1.Open the Machine.config file in a text editor such as Notepad.exe. The Machine.config file is typically located in the following folder:
%SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\
2.In the Machine.config file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to true.
3.If the debug attribute is true, change the debug attribute to false.

The following code sample shows the compilation element with debug set to false:
<compilation 
    debug="false"
/>
4.Save the Machine.config file.

Back to the top

REFERENCES

For more information, visit the following MSDN Web site:
Debug Mode in ASP.NET Applications
http://msdn2.microsoft.com/en-us/library/e8z01xdh(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/e8z01xdh(vs.71).aspx)
For additional information about remote debugging, click the following article number to view the article in the Microsoft Knowledge Base:
318041 (http://support.microsoft.com/kb/318041/EN-US/) HOW TO: Set Up and Use Remote Debugging in Microsoft Visual Studio .NET
818015 (http://support.microsoft.com/kb/818015/EN-US/) HOW TO: Tune and Scale Performance of Applications That Are Built on the .NET Framework

Back to the top


APPLIES TO
Microsoft ASP.NET 1.0
Microsoft ASP.NET 1.1

Back to the top

Keywords: 
kbhowtomaster kbwebforms kbdebug kbconfig kbwebservices kbdeployment KB815157

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.