1) Add such code to the service's entry, static Main() function,
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
2) install your windows service appliation with visual studio command tool. command line as follow:
installUtil.exe <Application's name>
3) Open your windows service source code with visual studio, start your windows service at service tool (you can find it at administrator's tool control panel),
then it will pop-up a dialog ask you if want to debug, select yes, that's ok, you can debug your application.
4) If you have modified your source code, you need uninstall the windows service, build your source code, reinstall agian.
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
2) install your windows service appliation with visual studio command tool. command line as follow:
installUtil.exe <Application's name>
3) Open your windows service source code with visual studio, start your windows service at service tool (you can find it at administrator's tool control panel),
then it will pop-up a dialog ask you if want to debug, select yes, that's ok, you can debug your application.
4) If you have modified your source code, you need uninstall the windows service, build your source code, reinstall agian.
本文介绍了一种调试Windows服务应用程序的方法,包括在代码中添加调试指令、使用Visual Studio安装及调试服务、更新源代码后的卸载与重新安装流程。
1245

被折叠的 条评论
为什么被折叠?



