如何调试在Init()方法失败的Windows服务 [英] How to debug windows service which fails in Init() method
本文介绍了如何调试在Init()方法失败的Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
您可以编程地将调试器作为函数中的第一行附加:
Debugger.Launch();
添加使用语句后:
使用System.Diagnostics;
I have a windows service which fails in Init() method and throws some exception , so only way for me to check what the error is by looking at the event log. I want to debug the windows service, but the problem is that i can attach debugger only when service is rnning, in my case it fails in Init() method only. Any idea ?
解决方案
you can programatically attach the debugger as the first line in the function:
Debugger.Launch ();
after adding the using statement:
using System.Diagnostics;
这篇关于如何调试在Init()方法失败的Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文