如何调试DLL项目使用Windows服务应用程序 [英] How to debug DLL project use a windows service application

查看:90
本文介绍了如何调试DLL项目使用Windows服务应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人



我使用Windows服务应用程序调用DLL项目。

我想进行单步调试。

如何调试DLL项目使用Windows服务应用程序?

当我选择配置属性 - > Debug->命令时,浏览到Windows服务应用程序,

然后按F5启动服务应用程序,Visual Studio显示错误。

(Windows服务应用程序从服务控制管理器启动,从服务器资源管理器开始)。

当我从服务控制管理器启动Windows服务应用程序时,

DLL项目的断点无法命中。



Dear ALL

I use a windows service application to call DLL project.
I want to do single-step debugging.
How to debug DLL project use a windows service application?
When I select Configuration properties->Debug->Command,browse to the windows service application,
then press F5 to start Service application,Visual Studio shows error.
(Windows Service Applications is start from Services Control Manager, from Server Explorer).
When I start Windows Service Application from Services Control Manager,
the breakpoint of DLL project can not hit.

Any help is appreciated.Thanks.

Best Regard



s


s

推荐答案

您可以将调试器附加到服务并在服务条目代码上设置一个断点。

如何:调试Windows服务应用程序应该可以帮助您调试服务。
You can attach the debugger to the service and put a breakpoint on the service entry code.
How to: Debug Windows Service Applications should help you in debugging a service.


调试DLL的最佳方法是不使用服务。 DLL用作库。您最好编写一些用于测试DLL的调试项目。这比调试服务应用程序(如果您的意思是Windows服务)简单得多。调试服务应用程序是一个特殊问题,有不同的方法可能需要整篇文章来描述。



如果执行没有在断点处停止,请检查所有设置并确保启用调试信息,重新构建项目。另一个原因可能是:在调试会话中永远不会达到断点。要隔离不同的问题,请在代码行中添加一个断点,以确保无论发生什么情况。然后尝试找出执行的位置和不执行的位置。这个以及许多其他技术有助于调试技能,对开发非常重要。



-SA
The best way to debug a DLL is not using service. DLL is used as a library. You should better write some debug project for testing the DLL. This is much, much simpler than debugging the service application (if you mean a Windows Service). Debugging of Service Application is a special issue, there are different approaches which may require whole article to describe.

If the execution is not stopping at a break point, check up all settings and make sure that debug information is enabled, re-build the project. The other reason could be this: the break point is never reached in your debug session. To isolated different problems, add a break point to the line of code which will be reached for sure, not matter what happens. Then try to figure out where your execution goes and where it doesn't. This and many, many other techniques contribute to debugging skills, very important in development.

—SA


谢谢。

但我需要调试DLL项目,而不是服务。

断点在DLL项目中。
Thanks.
But I need to debug the DLL project,not the service.
The breakpoint is in DLL project.


这篇关于如何调试DLL项目使用Windows服务应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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