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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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…