In ASP.Net I can use a http handler or module to catch errors.
I need something equivalent for my windows service.
I'm thinking something like Application.OnError += ErrorHandlingMethod;
Any ideas?
In ASP.Net I can use a http handler or module to catch errors.
I need something equivalent for my windows service.
I'm thinking something like Application.OnError += ErrorHandlingMethod;
Any ideas?
The asp.net features this possibility, as it has a complex execution pipeline, where you want to catch a general error. This is not the case in windows services, as it only provides you the OnStart method, to start your service stuff.
that also means, that you can easily wrap everything in there with a try ... catch block. so no need for a general error handling method.
if you want it even more general, than go to the Program.cs, and add that catch block there...