Debug Mode in ASP.NET Applications
The document is archived and information here might be outdated

Debug Mode in ASP.NET Applications

To set debug mode for an ASP.NET application, you must edit the application's Web.config configuration file. Usually, the Web.config for your ASP.NET application is located at the same URL location as your application. If your ASP.NET application is at, the Web.config for the application would normally be

The Web.config is an XML format file. You can edit the file using any standard text editor or XML parser. You cannot access the file remotely using a Web browser, though. For security reasons, ASP.NET configures Microsoft IIS to prevent direct browser access to Web.config files. If you attempt to access a configuration file using a browser, you will get HTTP access error 403 (forbidden).

The Web.config file contains nested sections marked by tags. The following example shows a typical Web.config file. Look for the <compilation> tag. This marks the beginning of the <compilation> section. In this section, you can specify the debug attribute. In the example shown below, the debug is the second attribute specified in the <compilation> section, but the order does not matter. Attributes are case sensitive, so be sure to specify "debug", not "Debug" or "DEBUG". Set debug to "true", as shown here:

      <compilation defaultLanguage="VB"
            <compiler language="VB;VBScript"
               type="Microsoft.VisualBasic.VBCodeProvider,system, Version=1.0.5000.0,  Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            < compiler language="C#;Csharp"
               type="Microsoft.CSharp.CSharpCodeProvider,system, Version=1.0.5000.0,  Culture=neutral, PublicKeyToken=b77a5c561934e089" />

""            <add assembly="ADODB" />
            <add assembly="*" />

            <add namespace="System.Web" />
            <add namespace="System.Web.UI" />
            <add namespace="System.Web.UI.WebControls" />
            <add namespace="System.Web.UI.HtmlControls" />


ASP.NET automatically detects any changes to Web.config files and applies the new configuration settings. You do not have to reboot or restart the server for changes to take effect.

ASP.NET applications inherit settings from Web.config files at higher levels in the URL path. So, if your ASP.NET application is at, you could specify debug="true" in rather than If you specify debug="true" in, the setting will affect all ASP.NET applications lower down (in,, unless the setting is overridden in a lower Web.config file. Hierarchical configuration files allow you to change settings for several ASP.NET applications simultaneously.

Enabling debug mode will greatly affect the performance of your ASP.NET application. Remember to disable debug mode before you deploy a release application or conduct performance measurements.

See Also

Debugging an ASP.NET Web Application

© 2016 Microsoft