开发者

Error Handling in Windows Service

How can i write generic error handler in my windows service? I tried the following code in OnStart method but it is not catching the exceptions.

protected override void开发者_StackOverflow OnStart(string[] args)
{

                AppDomain.CurrentDomain.UnhandledException += new 
UnhandledExceptionEventHandler(UnhandledExceptionTrapper);
                this.Start();
}

Is there something i am missing here?


You're probably getting exceptions on background threads. Wrap all code in all event handlers in try/catch blocks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜