我可以使用 VS2010 的 Intellitrace 来收集 Windows 服务的数据吗?
我有一个 Windows 服务,我想收集一些有关使用 Intellitrace 的调试数据 - 问题是您无法通过直接从 VS 内部启动 Windows 服务来调试它。我已经安装了该服务,Service.Start 中的第一个语句是“Debug.Break”,它允许我附加 VS。但是,如果附加时进程已启动,则无法使用 Intellitrace。
有人知道这个问题的解决方法吗?
I have a Windows service that I'd like to gather some debugging data on using Intellitrace - the problem is that you can't debug a Windows Service by starting it directly from inside VS. I have the service installed, and the very first statement in Service.Start is "Debug.Break", which allows me to attach VS. However, you can't use Intellitrace if a process is already started when you attach.
Does anybody know of a workaround for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需一点点工作就有可能实现。总体思路是模拟一个控制台应用程序,该应用程序将调用服务的 OnStart 和 OnStop 方法。这不是服务将经历的确切启动和停止路径,但希望它能让您诊断问题。我提供了一些示例代码来让您有一个大概的了解。
It is possible with a little bit of work. The general idea is to mock up a console application that will call the OnStart and OnStop methods of the service. It's not the exact start and stop path a service will go through but hopefully it get you to the point that you can diagnose your issue. I included some sample code to give you a general idea.
埃文的技术并没有回答最初的问题。
有关解决方案,请参阅 http:// /blogs.msdn.com/b/msaffer/archive/2011/02/23/using-intellitrace-with-services.aspx。很快在 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services*myservice* 下创建一个注册表多字符串值名称“Environment”,共三行
Evan's technique does not answer the original question.
For a solution see http://blogs.msdn.com/b/msaffer/archive/2011/02/23/using-intellitrace-with-services.aspx. Shortly create a registry multi-string value name "Environment" under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services*myservice* with three lines