You probably will not believe it when I simply tell you that
<compilation debug="true"> can hurt your application’s
performance as bad as it does in ASP.NET production websites! I have already
seen a lot of really good articles and blog posts related to this topic telling
what can go wrong when you have debug set to true in ASP.NET production
websites. In this article I will try to show it in a little more detail so that
you are well informed on this attribute and why I am asking you to turn it off
in production websites.
NOTE: Going forward in this article, wherever I say
web.config I mean web.config in your production websites (and not in
development machines) until mentioned otherwise explicitly. Also, I am not
talking about the global web.config which comes with .NET 2.0. I am just
talking about all the web.config files in the root directory of your ASP.NET
application’s Virtual Directory/Website. Changing anything in your web.config
will raise a File Change Notification event and your application domain will
recycle and your application users might get logged off if you are using In
Process sessions. So, if you want to make any changes to any of the web.config
files, do it in your application's maintenance time.
NOTE: Although I am using Microsoft Visual Web Developer
2005 Express Edition for all the samples, I will cover both .NET 1.1 and 2.0 in
this article.
If you do not want to read the nitty-gritty of this
attribute and trust me straight away, find all your web.config files with
<compilation debug=“true”> and change it to <complication
debug=“false”>. In case you are of the curious types… take a plunge.