Beware with debug="true" in Web.config file of an ASP.Net web application

Problem

I thought of sharing this information with the users of the user group and the readers of this blog. I just came across with an odd situation in my enhancement project developed in ASP.Net 1.0. (As usual) Tongue Tied

The problem was that I compiled the project in the "Debug" mode and it went through rigorous testing and life was good. But, later on I noticed that I compiled with "Debug" mode and changed back to "Release" mode and re-compiled the application. This is because if we use debug="true" in our production (live) application it will perform less efficiently than when we use debug="false". See below comments of a sample Web.config file.

</httpModules>

<!-- DYNAMIC DEBUG COMPILATION Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to false will improve runtime performance of this application. Set compilation debug="true" to insert debugging symbols (.pdb information) into the compiled page. Because this creates a larer file that executes more slowly, you should set this value to true only when debugging and to false at all other times. For more information, refer to the documentation about debugging ASP.NET files. -->

<compilation defaultLanguage="c#" debug="true" />

If you need further clarifications on why there's a performance issue please refer to the following article by experts in the industry because this article is about a different scenario related to these settings.

Beware of deploying debug code in production - by Milan Negovan

Don’t run production ASP.NET Applications with debug=”true” enabled - by Scott Guthrie @ Microsoft

Ok back to the problem. Then after this change one of the pages that retreive data from two databases start giving "Request Timed Out" error. This page normally takes more than two minutes to retrieve data. Again if I set debug="true" and re-compile this  page wouldn't give any errors. It's wired. So I sort help from good old friend Google.

Solution

When I searched Google I found many people has faced the same issue way before than me (see references). According to the replies in these forums I realised that we just need to add the following tag within <system.web> </system.web> tags. E.g

<system.web>

<httpRuntime executionTimeout="300" /> <!-- Newly added tag to the Web.config -->

 ............

</system.web>

References

DevX Discussions

Velocity Reviews

 

 

 

Published Sunday, January 06, 2008 3:26 AM by Manjula Perera

Comments

No Comments
Powered by Community Server (Non-Commercial Edition), by Telligent Systems