.net - Catching all exceptions in windows service C# -
Is there any way I can catch all kinds of exceptions in windows services? It's as if I have a service that should keep me going forever and now if some connecting databases or third party servers die for a moment then I do not want to stop my service. I want that the exception to the timer Should be given and after some time when the servers are up, they should work, but with the exception of now, my window service is brought down. PS - I have read the Kharaaba Exception Handler so far, but I'm not sure if this service prevents crashes. I also try to capture completely to catch generic exceptions (event handler). No, it is not. You can use the event to generate debug information before your app crashes. But creating your own exception management should not be that difficult. All services have an entry point ( Service.OnStart ) where you open your own thread / timer. Wrap all the code in that thread / timer with an attempt / grip, it should catch all the exceptions...