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.
精彩评论