views:

82

answers:

1

We have a website project. We are logging unhanded exceptions via a appdomain level exception handler.

When we set debug= true in web.config, the exception log is showing the offending line numbers in the stack trace.

But when we set debug = false, in web.config, log is not displaying the line numbers.

We are not in a position to convert the website project in to webapplication project type at this time. Its legacy application and almost all the code is in aspx pages. We also need to leave the project in 'updatable' mode. i.e. We can't user pre-compile option. We are generating pdb files.

Is there anyway to tell this kind of website projects to generate the pdb files, and show the line numbers in the stack trace?

+2  A: 

Add compilerOptions="/debug:pdbonly" as an attribute to <compiler> in your web.config file:

    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp"  compilerOptions="/debug:pdbonly" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler><!-- removed vb.net stuff -->
        </compilers>
    </system.codedom>

Here's some more info on setting up compiler options in ASP.NET: http://msdn.microsoft.com/en-us/library/a15ebt6c.aspx

Nate