Starting a windows service fails with error 1053

后端 未结 10 1340
逝去的感伤
逝去的感伤 2020-12-10 13:41

I have a windows service that is failing to start, giving an error \"Error 1053: The service did not respond to the start or control request in a timely fashion\".

相关标签:
10条回答
  • 2020-12-10 14:35

    Could be a number of things and it might help to get a stack trace on the machine exhibiting the problem. There are a number of ways to do this but the point is that you have to see where this is failing in the code.

    You can do this with remote debugging, but a simple thing might be to just log to the event logger, or file log if you have that. Literally, putting "WriteLine("At class::function()") throughout portions of the code to see if you've made it there.

    This will at least get you looking in the right direction (which ultimately is the code).

    Update:

    See Microsoft's How to Debug Windows Services article for details in troubleshooting startup problems using WinDbg.

    This related question details nice ways to debug services that are written in .NET.

    0 讨论(0)
  • 2020-12-10 14:35

    I agree with Scott, the easiest way to find out what's happening is to put some traces in the start-up code (maybe it doesn't even come to your start-up code).

    If this doesn't help, you can post your code here so others can take a look.

    0 讨论(0)
  • 2020-12-10 14:35

    If the StartRoutine is empty, you are probably starting it somewhere else.

    IIRC you need to fire off a worker thread, and then return from StartRoutine.

    0 讨论(0)
  • 2020-12-10 14:37

    One other reason is If you copy the DLL in 'debug' mode to installation folder this issue will come.What you need to do is Run the project in 'Release' mode copy the DLL or directly form Release folder rather than Debug folder,,and copy that DLL in to installation folder,it will work.You can see the reduction in size of DLL ,it will not contain any debug symbols and like that

    0 讨论(0)
提交回复
热议问题