0
votes

I have a windows service that creates an instance of UdpClient class and listen for incoming request. I have a helper class to run it as a console application. When i run it as a console program, it runs fine and receive connections normally. When deployed as a Windows Service using "installutil MyService" and start it, I get the following error: "Error 1053: the service did not respond to the start or control request in a timely fashion." The service don't even start, so I can't place a breakpoint in code. Any suggestion about how to debug this or where to look? Thanks.

1
Can you share any errors that may be in the EventViewer?Chris

1 Answers

2
votes

Your Start() method is taking too long to do whatever it does when the service starts - if memory serves you have something like 15 seconds to kick-off whatever tasks the service is supposed to perform (on separate threads for long-running or continuous activities) and you must then allow the startup method to end so that the Service Controller recognises that the service has finished starting.

You didn't post any code, but my assumption would be that you're listening for UDP traffic synchronously - so the startup method just sits there waiting for UDP messages and never ends. Put the UDP listener into its own thread, start that thread, and then let the startup method end.