Error 1053: the service did not respond to the start or control request in a timely fashion

后端 未结 30 841
無奈伤痛
無奈伤痛 2020-11-29 18:47

I have recently inherited a couple of applications that run as windows services, and I am having problems providing a gui (accessible from a context menu in system tray) wit

相关标签:
30条回答
  • 2020-11-29 19:24

    My issue was due to target framework mentioned in windows service config was

    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
     </startup>
    

    and my server in which I tried to install windows service was not supported for this .Net version.

    Changing which , I could able to resolve the issue.

    0 讨论(0)
  • 2020-11-29 19:26

    I faced this problem because of a missing framework on the box running my service. The box had .NET 4.0 and the service was written on top of .NET 4.5.

    I installed the following download on the box, restarted, and the service started up fine: http://www.microsoft.com/en-us/download/details.aspx?id=30653

    0 讨论(0)
  • 2020-11-29 19:26

    I'm shooting blind here, but I've very often found that long delays in service startups are directly or indirectly caused by network function timeouts, often when attemting to contact a domain controller when looking up account SIDs - which happens very often indirectly via GetMachineAccountSid() whether you realize it or not, since that function is called by the RPC subsystem.

    For an example on how to debug in such situations, see The Case of the Process Startup Delays on Mark Russinovich's blog.

    0 讨论(0)
  • 2020-11-29 19:28

    Install the debug build of the service and attach the debugger to the service to see what's happening.

    0 讨论(0)
  • 2020-11-29 19:29

    Took me hours, should have seen the event viewer get_AppSettings().

    A change in the app config, caused the problem.

    0 讨论(0)
  • 2020-11-29 19:30

    To debug the startup of your service, add the following to the top of the OnStart() method of your service:

     while(!System.Diagnostics.Debugger.IsAttached) Thread.Sleep(100);
    

    This will stall the service until you manually attach the Visual Studio Debugger using Debug -> Attach to Process...

    Note: In general, if you need a user to interact with your service, it is better to split the GUI components into a separate Windows application that runs when the user logs in. You then use something like named pipes or some other form of IPC to establish communication between the GUI app and your service. This is in fact the only way that this is possible in Windows Vista.

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