这让我抓狂。我使用 VS 2008 通过 C# 实现了此 Web 服务。我将其发布在 IIS 上。我修改了发布版本,以便将 pdb 文件与 dll 一起复制到 inetpub 上的目标目录中。
web.config 文件也有 debug=true。
然后我调用一个抛出异常的 Web 服务。堆栈跟踪不包含行号。我不知道我在这里缺少什么,有什么想法吗?
其他信息: 如果我使用 VS 内置 Web 服务器运行 Web 应用程序,它就会工作,并且我会在堆栈跟踪中获取行号。但是,如果我将 VS 内置 Web 服务器正在使用的相同文件(pdb 和 dll)复制到 IIS,堆栈跟踪中仍然缺少行号。
似乎有与 IIS 有关的东西忽略了 pdb 文件!
更新 当我发布到 IIS 时,所有 pdb 文件都发布在 bin 目录下,一切看起来都很好。但是当我转到与我的项目相关的特定目录下的“C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files”时,我可以看到程序集(.dll)文件都在那里,但没有 pdb 文件。 但如果我使用 VS 内置 Web 服务器运行项目,则不会发生这种情况。 因此,如果我手动将 pdb 文件复制到临时文件夹,我可以看到行号。
知道为什么 pdb 文件没有复制到临时文件夹吗?
顺便说一句,当我附加到工作进程时,我可以看到它显示符号已加载!
最佳答案
我遇到了同样的问题,并尝试了一切方法来尝试解决它。直到我在这个类似的问题中找到接受的答案之前,什么都没有起作用:IIS not giving line numbers in stack trace even though pdb present .
It turns out using impersonation with the web.config:
<identity impersonate="true" />
causes the loss of the line numbers in the stacktrace. I took the entry out and my line numbers returned, put it back and after a few hours (Kerberos ticket refreshing?) the line numbers disappeared again.
Not sure why impersonation affects the stack trace but it does - would be happy to have someone confirm / explain this...
我需要为我的大多数网站打开模拟(这些网站有行号,想想看),所以我为这个特定网站禁用了它并得到了我的行号!!
关于.net - 尽管包含 PDB 文件,堆栈跟踪中仍缺少行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2204084/