尽管包含 PDB 文件,堆栈跟踪中仍缺少行号

发布于 2024-08-20 12:00:41 字数 722 浏览 11 评论 0原文

这让我抓狂。我使用 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 文件没有复制到临时文件夹吗?

顺便说一句,当我附加到工作进程时,我可以看到它说符号已加载!

This is running me nuts. I have this web service implemented w/ C# using VS 2008. I publish it on IIS. I have modified the release build so the pdb files are copied along with the dlls into the target directory on inetpub.

Also web.config file has debug=true.

Then I call a web service that throws an exception. The stack trace does not contain the line numbers. I have no idea what I am missing here, any ideas?

Additional Info:
If I run the web app using VS built-in web server, it works and I get line numbers in stack trace. But if I copy the same files (pdb and dll) that the VS built-in web server is using to IIS, still the line numbers are missing in stack trace.

It seems that there is something related to the IIS that ignores the pdb files!

Update
When I publish to IIS, all the pdb files are published under the bin directory and everything looks fine. But when I go to "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" under the specific directory related to my project, I can see that the assembly (.dll) files are all there, but there is no pdb files.
But this does not happen if I run the project using VS built-in web server.
So if I copy the pdb files manually to the temp folder, I can see the line numbers.

Any idea why the pdb files are not copied to the temp folder?

BTW, when I attach to the worker process I can see that it says Symbols loaded!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

昵称有卵用 2024-08-27 12:00:41

我遇到了同样的问题,并尝试了一切方法来尝试解决它。直到我在这个类似的问题中找到可接受的答案:即使存在 pdb,IIS 也没有在堆栈跟踪中给出行号

事实证明,在 web.config 中使用了模拟:

<identity impersonate="true" />

导致堆栈跟踪中的行号丢失。我取出条目,行号返回,然后将其放回去,几个小时后(Kerberos 票证刷新?)行号再次消失。

不确定为什么模拟会影响堆栈跟踪,但确实如此 - 很高兴有人确认/解释这一点...

我需要为我的大多数网站打开模拟(这些网站有行号,请看图),所以我为这个特定的网站禁用它并得到我的行号!

I had this is same issue and tried everything under the sun to try and fix it. Nothing worked until I found the accepted answer in this similar question: 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...

I need impersonate to be turned on for most of my sites (and those sites have line numbers, go figure) so I disabled it for this particular website and got my line numbers!!

余罪 2024-08-27 12:00:41

也许您要发布到的服务器在系统 machine.config 文件中配置了 设置:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

有关详细信息,请参阅:

ASP.NET 配置 - 部署元素 (ASP.NET) NET 设置架构)

只是一个想法。

Maybe the server you're publishing to has the <deployment retail="true" /> setting configured in the system machine.config file in:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

For more info see:

ASP.NET configuration - deployment Element (ASP.NET Settings Schema)

Just a thought.

偏爱自由 2024-08-27 12:00:41

使用 VS 或 Windbg 连接到工作进程,看看它是否能够找到您的 pdb 以及它是否与您的程序集匹配?

另一个常见原因是您实际上使用的是发布 dll [已优化]。我怀疑这与 IIS 有何特定关系。

Attach to worker process using VS or windbg and see whether it is able to find your pdb and whether it matches your assembly?

Another common reason is you are actually using release dlls [which are optimised]. I doubt it is anything specific to do with IIS.

溺ぐ爱和你が 2024-08-27 12:00:41

请确保在 web.config 中设置“debug=true”,如果没有它,异常中不会显示行号。

Please make sure to set "debug=true" in the web.config, without it, no line numbers are shown in exceptions.

一个人的旅程 2024-08-27 12:00:41

不确定这是否有帮助,但在我的 VS2008 C# 项目属性中,在“构建”选项卡下,有一个“高级”按钮,我必须在其中将调试信息设置为“完整”或“仅 pdb”

Not sure if this will help, but in my VS2008 C# project properties, under the build tab, there's an Advanced button where I had to set debug info to "full" or "pdb-only"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文