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

后端 未结 30 960
無奈伤痛
無奈伤痛 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:20

    In my case, I had this trouble due to a genuine error. Before the service constructor is called, one static constructor of member variable was failing:

        private static OracleCommand cmd;
    
        static SchedTasks()
        {
            try
            {
                cmd = new OracleCommand("select * from change_notification");
            }
            catch (Exception e)
            {
                Log(e.Message); 
                // "The provider is not compatible with the version of Oracle client"
            }
        }
    

    By adding try-catch block I found the exception was occuring because of wrong oracle version. Installing correct database solved the problem.

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

    open the services window as administrator,Then try to start the service.That worked for me.

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

    In my case it was permission for user account in AD. After set it correctly, it works perfect.

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

    In service class within OnStart method don't do huge operation, OS expect short amount of time to run service, run your method using thread start:

    protected override void OnStart(string[] args)
    {
        Thread t = new Thead(new ThreadStart(MethodName)); // e.g.
        t.Start();
    }
    
    0 讨论(0)
  • 2020-11-29 19:23

    In my case the problem was missing version of .net framework.

    My service used

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

    But .net Framework version of server was 4, so by changing 4.5 to 4 the problem fixed:

    <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>
    
    0 讨论(0)
  • 2020-11-29 19:24

    This problem usually occurs when there is some reference missing on your assembly and usually the binding fails at the run time.

    to debug put Thread.Sleep(1000) in the main(). and put a break point in the next line of execution.

    Then start the process and attach the debugger to the process while it is starting. Press f5 after it hit the break point. It will throw the exception of missing assembly or reference.

    Hopefully this will resolve this error.

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