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
Comments
Anonymous
April 14, 2009
PingBack from http://asp-net-hosting.simplynetdev.com/tip-52-did-you-know-when-deploying-your-aspnet-web-application-debugfalse-should-be-set-in-webconfig/Anonymous
April 14, 2009
To help troubleshoot problems, developers usually enables the debug mode in web.config file. This causesAnonymous
April 14, 2009
It's a real pain that this is separate from the build configuration for web app projects. I realize web deployment projects can address this, but that's not built in to VS. Hopefully VS2010 will improve things here.Anonymous
April 21, 2009
My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Ben Scheirman wrote up a walk-through of exporting Visual Studio solutions with SolutionFactory . The Web Developer Tools Team postedAnonymous
April 21, 2009
The comment has been removedAnonymous
February 16, 2010
Note, if your Machine.config contains the following content <system.web> <deployment retail=”true”/> </system.web> You cannot debug your web application or website anymore.Anonymous
February 11, 2011
The comment has been removed