>What's the best practice for getting things going in a Windows service?. If I understand right, OnStart needs to comlete within 30 seconds, and you're also supposed to put your code there that makes the service useful.
>
>In the couple services I have, I've launched a thread from OnStart to start the never-ending stuff my code needs to do. Is this considered ok, or is there a better method?
>
>Thanks,
>Mike
You'll also want to wrap any calls in OnStart in a try/catch. If any of your code in the other thread throws an exception, you want to make sure your service continues to run and can recover or log the problem. Otherwise you'll find your service seems to stop every once in a while and it can be hard to figure out why.