How do you prevent a .NET service from timing out while waiting on a dependent service
Question
I have a C# based service that is dependent on the MSMQ service. In some scenarios the MSMQ service takes a long time to start, apparently resulting in a timeout of the C# service. How can I fix this programatically?
Edit: It appears that the bug report I was working on was incorrect, the service does indeed start eventually. I apologize for the confusion
Solution
Normally waiting on a queue should be made in a separate thread, which should be started directly in the OnStart Method of the Service. If you do it this way, the Start-command succeeds and the service will not time out.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow