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

    Question

  • Please help!

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

    I receive this error when trying to start a simple Windows Service i've made in .NET 1.1. This happens only at my first attempt to start the service. The second attempt succeeds. Pausing and resuming have no problems. After I stop it i recieve the same Error 1053 at the first attempt.

    DETAILS:

    The event handles for the Stop and Start Events are empty:

    protected override void OnStart(string[] args)
    {
    }

    protected override void OnStop()
    {
    }

    I also put a line to write to the applicatin log (AutoLog property being True as well) in the constructor.

    public Service1()
    {
        // This call is required by the Windows.Forms Component Designer.
        InitializeComponent();

        // TODO: Add any initialization after the InitComponent call
        EventLog.WriteEntry("Service1 constructor...");
    }


    Please help! I want to put this service on a machine to start automatically it the machine reboots and i don't want to use the recovery action to restart the service if it fails.

    Thanks!
    Saturday, March 04, 2006 1:24 PM

Answers

  • I also used performance counter fr my service. This must have caused the problem. My best guess regarding the prblem would be that at the first attempt the perf counter category needed was not created. The first attempt might have created it as well. Therefore the second attempt was successful. Stopping the service deletes the perf counter i think and the whole story repeats.

    I have performed no actions regarding the performance counters. I just added it and also in installer for it.
    Saturday, March 04, 2006 1:31 PM

All replies

  • I also used performance counter fr my service. This must have caused the problem. My best guess regarding the prblem would be that at the first attempt the perf counter category needed was not created. The first attempt might have created it as well. Therefore the second attempt was successful. Stopping the service deletes the perf counter i think and the whole story repeats.

    I have performed no actions regarding the performance counters. I just added it and also in installer for it.
    Saturday, March 04, 2006 1:31 PM
  • Cause

    This issue is Microsoft-related. The ServiceBase class calls the OnStop method directly from the Service command handler defined in the ScDispatcherLoop of the Advapi32.dll file. After 30 seconds, if the ScDispatcherLoop thread is not ready to receive a new service command from the Service Control Manager, the Windows Service Controller marks the service as time out. Therefore, you receive the error message.

    Resolution

    To resolve this problem, obtain the latest service pack for the Microsoft .NET Framework 1.1.

    Friday, July 13, 2007 12:31 PM
  • Gabi, I already experienced the same error using performance counters in a windows service developed with c#.

     

    Did you set the MachineName property to "." string ?

     

    I resolved the problem using System.Environment.MachineName wich return the netbios name of the computer instead of using "."

     

    I don't know why PerformanceCounter cannot be initialized with this value at the service start event..... But using the hostname instead works.

     

     

    Friday, July 13, 2007 1:45 PM
  • Try this--------------------------------------------------------------

     

    this is a bug with .Net Framework. plz clear all the events in application Log in your event viewers and then try starting the service. it has worked for me. the services would timeout if the logs are full.

     

    Thanks

    • Proposed as answer by Sona75 Thursday, September 03, 2009 6:04 PM
    Thursday, October 25, 2007 3:51 PM
  •  Moumst wrote:

    Gabi, I already experienced the same error using performance counters in a windows service developed with c#.

     

    Did you set the MachineName property to "." string ?

     

    I resolved the problem using System.Environment.MachineName wich return the netbios name of the computer instead of using "."

     

    I don't know why PerformanceCounter cannot be initialized with this value at the service start event..... But using the hostname instead works.

     

     

     

    This has solved my problem as well. Thank you.

    Wednesday, May 14, 2008 4:23 PM
  • Dang the problem is back aagain. Time for further research on error 1053 with service using a performace counter.

    Wednesday, May 14, 2008 4:30 PM
  • OK, I moved the creation of the Performance counter to the Start method instead of the declaration and now it works and hopefully will continue working.

    Wednesday, May 14, 2008 5:12 PM
  • This can be a microsoft .Net v1.1 related bug.
    Please see http://support.microsoft.com/kb/839174 for details.

    Thanks,
    Sharmin
    Wednesday, June 04, 2008 7:14 AM
  • I have a .NET 2.0 windows service and I was running into this error on Windows 2003 Server. The service started up just fine on XP or Vista, but the service would not start on a Windows 2003 Server and would throw the 1053 error. I finally found the problem. We use Dotfuscator to obfuscate the code in the service.

    If you go into Dotfuscator on the Rename tab and make sure that you don't rename anything in the .My section of the service, it fixes the problem. I don't know why XP would read this obfuscated/renamed code just fine and Windows Server 2003 wouldn't, but it solved my problem.

    Hopefully this will help somebody else, it was a pain to try to track down.
    Friday, June 13, 2008 4:27 PM
  • Ok I am having this issue where on install of an app that uses SQL Express 2005 SP3 I stop the instance service just fine but literally everyother time when I start the service it fails. This stopping and starting all takes place right after logging in on Vista Business 64bit.

    Have tried the solutions above of naming the machine name specifically but no help. .Net installed is 3.5 SP1 so no issue with v1.1.

    Any thoughts?
    Friday, August 21, 2009 7:14 PM
  • I'm having the same problem with BizTalk Server 2009 on Vista x64.

    I cannot start a Host Instance (which is in effect a windows service) using a domain account which is added to the local admin group.

    But when I change it to Local System it works.

    Have not had the problem on Windows Server 2008 x64 and certainly never had it on XP
    Thursday, September 03, 2009 2:35 AM
  • I'm having the same problem with BizTalk Server 2009 on Vista x64.

    I cannot start a Host Instance (which is in effect a windows service) using a domain account which is added to the local admin group.

    But when I change it to Local System it works.

    Have not had the problem on Windows Server 2008 x64 and certainly never had it on XP


    Found the problem and this is a beauty.

    Nestled in the BizTalk LOB Adapters documentation is a line that states that the LOB Adapters are not supported on Vista although they are on Server 2008 (odd when you consider that in 2006 they were supported on both XP and Server 2003)

    Bizarrely the install will still be allowed to proceed on Vista and when you do it.... VOILA! the host instances stop working. Remove it and they work again.

    Therefore if you're going to be doing BizTalk Server 2009 you must have everyone running Server 2008 or you can use the BizTalk Adapter Pack 2.0 which supports both Vista and Server 2008
    Thursday, September 03, 2009 11:35 PM
  • This was the solution for me too. 

    I had the same symptoms where the service would timeout the first time but start successfully if you try again.  I'm using .NET Framework 3.5 on WinXP.

    PerformanceCounter objects cannot be created directly from the Dim statement of a global variable in the Service class.  They must be instantiated from the OnStart event handler instead. 

    Setting the MachineName property of the performance counter from the constructor had no effect on my results.

    bad:
    Dim xxx As New System.Diagnostics.PerformanceCounter("Memory", "Available MBytes")

    good:
    Dim xxx As System.Diagnostics.PerformanceCounter
    Protected Overrides Sub OnStart(ByVal args() As String)
        xxx = New System.Diagnostics.PerformanceCounter("Memory", "Available MBytes")
    End Sub
    Tuesday, October 13, 2009 7:42 PM
  • Hi,

     

    I am having the same issue with .net 4.0 on Win2003 R2.

    However, I have a different implementation.

    Inside the OnStart, I call a static StartProcessing() function on my Controller class.

    The StartProcessing class among other things resets my perfcounter values to zero.

    Here is the implementation of my PerfMon class.

     public class PerfMon
        {

          public static PerformanceCounter DupMsgsCount = null;

          static PerfMon()
            {
                Initialize();           
            }

          private static void Initialize()
            {
                DupMsgsCount = new PerformanceCounter("MYCOUNTERS", "DupMsgsCount");
                DupMsgsCount.ReadOnly = false;

             }

           public static void ResetCounters()
            {
                DupMsgsCount.RawValue = 0;

            }

    If I remove the line of code  PerfMon.ResetCounters();  then I service starts fine, but with this line in the code I get

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

    Also, if I run it two times in quick succession, the second time it succeeds.

    Is there a way to resolve this without moving my Controller's logic to the OnStart method?

     

    Monday, October 03, 2011 6:04 PM
  • why is that the service created with  c#.net 2.0  which starts in Windows XP doesn't start with windows server 2003? 
    I get an error message saying "Service didnot respond to the start (or) control request in a timely fashion" 
    How to resolve it? 
    Thanks in Advance 
    • Edited by Sri Sathiyan Wednesday, January 25, 2012 10:05 AM
    Wednesday, January 25, 2012 10:03 AM