本文介绍了在 Windows 服务中运行 cdb 时无法下载 Microsoft 符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .NET windows 服务,它调用 cdb.exe 来分析故障转储.我想在需要时自动从 http://msdl.microsoft.com 下载符号,使用参数:

I have a .NET windows service that is calling cdb.exe to analyze crash dumps. I want to download the symbols from http://msdl.microsoft.com automatically when needed, using the argument:

-y srv*c:\symbols*http://msdl.microsoft.com/download/symbols

如果我将应用程序作为控制台应用程序运行,它会按预期工作,并为每个转储下载所需的符号.

If I run the application as a console application, It works as expected and it downloads the needed symbols for each dump.

问题是当我将应用程序作为 Windows 服务启动时,没有下载符号,如果我打开 symnoisy,在 cdb 的输出日志中,我对每个符号都有一个条目,说明未在以下位置找到该符号http://msdl.microsoft.com

The problem is when I start the app as a windows service, the symbols are not downloaded and, if I turn symnoisy on, at cdb's output log I have an entry for each symbol saying that the symbol hasn't been found at http://msdl.microsoft.com

所以,我使用嗅探器检查过它,有趣的是当作为服务运行时,没有向微软符号服务器发出请求.

So, I've checked it using a sniffer and the funny thing is that no request is made to the microsoft symbols server when running as a service.

谷歌搜索一点,我发现我不是唯一有这个问题的人,似乎问题是在将应用程序作为 Windows 服务运行时,它使用的是 winHTTP 库对于 http 请求,而不是 wininet,我认为这是问题的根源:http://support.microsoft.com/kb/238425

Googling a little, I've found that I'm not the only one with this issue and it seems that the problem is that when running an application as a windows service, it is using winHTTP library for http requests, instead of wininet, which I think is the root of the problem: http://support.microsoft.com/kb/238425

所以,我不知道为什么,cdb 无法使用 winHTTP 库连接到 ms 符号服务器,我需要一种方法来强制 cdb 默认使用 wininet.

So, I don't know why, cdb is not able to connect to ms symbols server using winHTTP library and I need a way to force cdb use wininet by default.

有人知道解决此问题的方法吗?

Anyone has an idea of a workaround to this issue?

推荐答案

完整答案在这里:https://web.archive.org/web/20150221111112/http://infopurge.tumblr.com/post/10438913681/how-does-cdb-access-the-microsoft-symbol-server

从命令提示符运行时,cdb 使用 WinINet 访问 Internet 资源.从 Windows 服务运行时,cdb 使用 WinHTTP 访问 Internet 资源.

When running from a Command Prompt, cdb uses WinINet to access internet resources. When running from a Windows service, cdb uses WinHTTP to access internet resources.

对于 WinHTTP,您需要设置一些注册表设置以阻止尝试使用代理 (bogusproxy) 来访问符号服务器.

For WinHTTP you need to set some registry settings to stop an attempt to use a proxy (bogusproxy) for accessing the symbol server.

您可以从命令行强制 cdb 使用 WinHttp,从而通过在加载 cdb 之前键入以下内容来模拟服务中发生的情况以进行测试.

You can force cdb to use WinHttp from a command line, and thus emulate what is happening within the service for test purposes by typing the following before loading cdb.

SET DBGHELP_WINHTTP=AnythingOtherThanEmpty

要禁用 cdb 和 symsrv 的 WinHTTP 代理,您需要在注册表中设置以下项之一.

To disable the WinHTTP proxy for cdb and symsrv you need to set the one of the following keys in the registry.

对于在 Windows 服务环境中在 x32 位机器上运行的 x32 版本的 cdb.HKLM\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

For x32 version of cdb running on a x32 bit machine from the Windows Service environment.HKLM\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

对于从命令提示符在 x32 位机器上运行的 x32 版本的 cdb.HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

For x32 version of cdb running on a x32 bit machine from a Command Prompt.HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

对于在 Windows 服务环境中在 x64 位机器上运行的 x32 版本的 cdb.HKLM\Software\Wow6432Node\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

For x32 version of cdb running on a x64 bit machine from the Windows Service environment.HKLM\Software\Wow6432Node\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

对于从命令提示符在 x64 位计算机上运行的 x32 版本的 cdb.HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

For x32 version of cdb running on a x64 bit machine from a Command Prompt.HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

对于在 Windows 服务环境中在 x64 位计算机上运行的 x64 版本的 cdb.HKLM\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

For x64 version of cdb running on a x64 bit machine from the Windows Service environment.HKLM\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

对于从命令提示符在 x64 位计算机上运行的 x64 版本的 cdb.HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

For x64 version of cdb running on a x64 bit machine from a Command Prompt.HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\NoInternetProxy DWORD 1.

这篇关于在 Windows 服务中运行 cdb 时无法下载 Microsoft 符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 12:16