I have a windows service doing some repetitive work (wcf calls) after logging programmaticaly at a web server. All calls are invoked through various threads running dependently in parallel, but if for example, the connectivity is lost, or the iis recycles, hence the inproc session management directs me to re-login, I want to handle this exception, halt all other threads, propagate the exception up to main thread, retry to login and upon success to signal all threads to restart.
My main application is something like the following. I login, I start two workers and the exception handling mechanism in main thread is pending:
IFileManagerService fileManagerService = new FileManagerService();
IJobManagerService jobManagerService = new JobManagerService();
WindowsServiceSettings.AuthenticationService.Login(WindowsServiceSettings.Credentials.Split(':')[0], WindowsServiceSettings.Credentials.Split(':')[1]);
WriteToLogFile("Service Started at " + DateTime.Now);
fileManagerService.Start();
jobManagerService.Start();
Can I implement this via wait handles and how am I going to?
Thank you very much!