如何调试Windows服务和mutithreaded代码 [英] How to Debug a windows service and mutithreaded code

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

问题描述

大家好,



我有一个应用程序,它是一个Windows服务,它是一个多线程应用程序,它将加载其他dll和exes。此服务将在服务管理器中运行。



我的问题是,当我尝试调试应用程序时,它正在转移到winmain应用程序和另外一个编写的函数,即mymain()但是当我正在调试时,它正在移动wimnain和main以及一些函数,如服务表以及如何检查其他线程以及如何验证其他dll是否已加载?





非常感谢。等待你的回复。

hi Guys,

I have an application which is a windows service and it is a multithreaded application and it will load other dlls and exes. And this service will run in service manager.

My problem here is when i am trying to debug the application it is moving to the winmain application and one more written function i.e mymain() but when i am debugging it is moving in wimnain and main and some functions like service table and how to check other threads and how to verify whether other dlls are loaded or not?


Thanks a lot in advance.Awaiting for your reply guys.

推荐答案

这比其他应用程序更难。您可以在我过去的答案中找到一些想法:使用UI配置Windows服务 [ ^ ]。



-SA
This is more difficult than with other applications. You can find some ideas in my past answer: Configure Windows Service with UI[^].

—SA


在您的服务域中添加一个消息框,允许该服务进行交互使用桌面,让消息框通过调用 GetCurrentProcessId [ ^ ],并将调试器附加到它
add a messagebox in your servicemain, allow the service to interact with the desktop, have the messagebox advertise the pid with a call to GetCurrentProcessId[^], and attach the debugger to it


您可以查看此链接。几年前我的一位同事写了这篇文章



http://www.mindfiresolutions.com/3-Ways-To-Debug-A-Web-Service-In-Visual-Studio-1006.php [ ^ ]
Can you check this link. One of my colleague had written this few years back

http://www.mindfiresolutions.com/3-Ways-To-Debug-A-Web-Service-In-Visual-Studio-1006.php[^]


这篇关于如何调试Windows服务和mutithreaded代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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