1

I want to make an async call to a function in my windows service but I want to keep the service running without crashing when an exception happens from the async call.

I saw some posts where I would need to use await but won't this make the call behave like synchronous calls do? I don't need to wait for the result of the WCF to be sent to me but I can only make changes to the windows service not the WCF web service so I can't do something like

[OperationContract(IsOneWay = true)]
void PrintString(string message);

Is there a way to handle all WCF-caused exceptions in something like a try-catch or a global exception handler to keep my windows service from crashing?

Will the CurrentDomain_UnhandledException (saw this from the question linked below) catch the exception? If yes, would my windows service continue to run normally?

** Global exception handler for windows services?

Community
  • 1
  • 1
Bahamut
  • 1,929
  • 8
  • 29
  • 51

0 Answers0