General information
Category:
Coding, syntax and commands
Environment versions
Network:
Windows 2003 Server
Mike,
Does the service need the "never-ending stuff" to intialize? Usually a service will set some initial properties, set up it's event log, and then sit and wait for an event.
It might be better to move the code out of the OnStart and instead start a thread that will trigger the service's function that contains the code. This could make it a lot easier to troubleshoot any problems that occur. You won't have to attach the debugger to a separate thread and the service can make entries into the event log when exceptions occur.
>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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only