Tip # 52: Did you know... When deploying your ASP.NET web application, debug=false should be set in web.config

To help troubleshoot problems, developers usually enables the debug mode in web.config file. This causes ASP.NET to produce extra information in the compiled assemblies such as debug symbols, metadata. However, performance will be suffered as it takes longer to compile and run, consumes more memory and resource caching is not performed. Therefore, in production, we should set the debugging option back to false to avoid the effect on performance. There are two ways to achieve this.

1) In web.config file, set <compilation debug=”false”/>

2) You can also disable the <compilation debug=”true”/> switch for all ASP.NET applications on the system in production by setting the following in Machine.config:

    <system.web>
        <deployment retail=”true”/>
    </system.web>

The setting in machine.config will also turn off trace output in a page and detailed error messages remotely. More information about this switch can be found here.

machine.config file is typically located at %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG.

Thanks,
Anh Phan
SDET, Visual Web Developer