VS2008对Win7的64位:调试Windows服务 [英] VS2008 on Win7 64-Bit: Debugging a Windows Service

查看:335
本文介绍了VS2008对Win7的64位:调试Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想Windows服务使用VS2008对Win7的64位调试。我遇到的问题是,没有我的断点被击中,不管是哪个构建配置我选择:86,64或值为anycpu

I'm trying to debug a Windows Service using VS2008 on Win7 64-Bit. The problem I'm having is that none of my breakpoints are being hit, regardless of which build configuration I choose: x86, x64 or AnyCPU.

使用附加到进程的服务启动后,没有断点被击中 - 但IDE不会告诉我,他们不会被击中(通过使固体红色圆圈和大纲,例如) - 它只是似乎充当如果断点甚至不存在。

Using "Attach to Process" after the service has started, none of the breakpoints are hit - yet the IDE doesn't inform me that they won't be hit (by making the solid red circle and outline, for instance) - it simply seems to act as if the breakpoints weren't even there.

任何人都可以点我朝着正确的方向吗?

Can anyone point me in the right direction here?

感谢

/理查德。

推荐答案

显而易见的问题第一...

Obvious questions first...

  • 你在调试模式或发布模式编译?
  • 是在您的服务是从?安装位于.pdb文件
  • 你确定code其中断点设置实际上正在执行?

如果这些都不是问题,请尝试将在构造函数中以下行的为您服务。

If none of these are issues, try inserting the following line in the constructor for your service.

System.Diagnostics.Debugger.Break();

在启动服务之后,你应该会提示选择一个调试器。当调试器打开时,它会暂停在方案断点,您可以继续从那里。我不与Windows 7的工作,但我不希望Visual Studio 2008中的这方面已经多少改变从Windows XP。我用这个编程的方法所有的时间进入调试会话我的Windows服务。

When the service starts up, you should be prompted to choose a debugger. When the debugger opens, it'll pause at the programmatic breakpoint, and you can continue from there. I don't work with Windows 7, but I don't expect this aspect of Visual Studio 2008 has changed much from Windows XP. I use this programmatic method all the time to enter a debug session for my Windows service.

这篇关于VS2008对Win7的64位:调试Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆