在发布模式下的调试符号 [英] Debug symbols in release mode
问题描述
在一个ASP.NET 2.0网站登录我未处理的异常的细节。我想记录的源文件名和行号,但发生异常时我并不在堆栈跟踪得到这个。这样做的原因是,我有调试在web.config编译设置(这是一个生产基地)=假,因此正在服务器上生成任何PDB文件。有没有办法让ASP.NET生成在释放模式的调试符号文件?我不想precompile网站。
On an ASP.NET 2.0 website I log details of unhandled exceptions. I would like to log the source filename and line number, but I don't get this in the stack trace when an exception occurs. The reason for this is that I have debug="false" in the web.config compilation settings (it's a production site), therefore no PDB files are being generated on the server. Is there a way to get ASP.NET to generate the debug symbol files in release mode? I don't want to precompile the site.
推荐答案
好吧,我找到了答案。在系统codeDOM编译器设置,以获得符号:您可以设置调试=假来获得的优化,然后设置compilerOptions =pdbonly /调试。下面是相关的web.config摘录:
OK, I found an answer. You can set debug="false" to get optimisations, and then set compilerOptions="/debug:pdbonly" in the system.codedom compiler settings to get symbols. Here's the relevant web.config excerpts:
<system.web>
....
<compilation debug="false" defaultLanguage="c#">
...
</compilation>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
compilerOptions="/debug:pdbonly">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
...
</compilers>
</system.codedom>
这篇关于在发布模式下的调试符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!