Hi
In ASP.net, we get a global exception handler in the global.asax which I use to e-mail me the details of unhandled exceptions, and to redirect the user to some sort of apology page, and this works fine.
However, I'm writing my first Windows Service now and I'm puzzled.
If I do this
Throw New Exception("This exception was brought to you by the letter e"
Nothing at all happens. The service continues to run quite happily. I expected some sort of entry in the event log, but there is nothing.
What I'd like to do is to use an approach similar to the global.asax. I tried this in the sub main
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
With MyHandler writing an entry in the event log, but still nothing happens.
If I attach a debugger to the process, it steps to the line where I throw the exception and then pops up the standard exception dialog alert.
Obviously I don't intend to do all my exception handling globally, but I do need to be notified that an unhandled exception occured.
Does anyone have any ideas?
Thanks
Mark Mark![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)
In ASP.net, we get a global exception handler in the global.asax which I use to e-mail me the details of unhandled exceptions, and to redirect the user to some sort of apology page, and this works fine.
However, I'm writing my first Windows Service now and I'm puzzled.
If I do this
Throw New Exception("This exception was brought to you by the letter e"
Nothing at all happens. The service continues to run quite happily. I expected some sort of entry in the event log, but there is nothing.
What I'd like to do is to use an approach similar to the global.asax. I tried this in the sub main
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
With MyHandler writing an entry in the event log, but still nothing happens.
If I attach a debugger to the process, it steps to the line where I throw the exception and then pops up the standard exception dialog alert.
Obviously I don't intend to do all my exception handling globally, but I do need to be notified that an unhandled exception occured.
Does anyone have any ideas?
Thanks
Mark Mark
![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)