title: Windows Service won't start 'Error 1053: The service did not respond to the start or control request in timely fashion'
body: <p>I am currently working on a Windows Service as a non-GUI part of our application. </p>
  
  <p>I wrote a Service which, in Debug conditions, perfectly works. This means I debug by having my static void Main() as following:</p>
  
  <pre><code>#if(!DEBUG)
      ServiceBase[] ServicesToRun;
      ServicesToRun = new ServiceBase[] 
      { 
          new TRAservice() 
      };
      ServiceBase.Run(ServicesToRun);
  #else
      TRAservice Service = new TRAservice();
      Service.CanHandlePowerEvent = false;
      Service.CanHandleSessionChangeEvent = false;
      Service.CanPauseAndContinue = true;
      Service.CanShutdown = true;
      Service.CanStop = true;
      Service.ServiceName = "TRAservice";
      Service.AutoLog = false;
      Service.SetMethod();
      Service.TRAmethod();
  #endif
  </code></pre>
  
  <p>To do some implementation testing, I added a ProjectInstaller and I install my service via the VStools cmd prompt, installutil servicename.exe. 
  (For reference, I include the constructor of the service with the OnStart in the bottom of this post.)</p>
  
  <p>However, when I then try to START the service, I get the following error:
  <img src="https://i.stack.imgur.com/QAszM.png" alt="error" title="The error received when starting service"></p>
  
  <p>In my event viewer I get 4 messages (2 information (Windows error reports), 2 errors):</p>
  
  <p><img src="https://i.stack.imgur.com/j9oCY.png" alt="Error">
  <img src="https://i.stack.imgur.com/KQYaT.png" alt="Error"></p>
  
  <p>I have tried a lot of things, including, but not limited to, removing the debug lines out of the constructor (as elsewhere suggested), rebooting, installing from Release (instead of Debug)... </p>
  
  <p>I will take any suggestion to fix this problem. Thanks in advance. </p>
  
  <pre><code>public TRAservice()
  {
      InitializeComponent();
  
      CanHandlePowerEvent = false;
      CanHandleSessionChangeEvent = false;
      CanPauseAndContinue = true;
      CanShutdown = true;
      CanStop = true;
      ServiceName = "TRAservice";
      AutoLog = false;
  
      sSource = "TRAservice";
      sLog = "TRAlog";
  
      if (!EventLog.SourceExists(sSource))
      {
          EventLog.CreateEventSource(sSource, sLog);
      }
  
      eventLog1 = new System.Diagnostics.EventLog();
      eventLog1.Source = sSource;
      eventLog1.Log = sLog;
  
      eventLog1.WriteEntry("Service started", EventLogEntryType.Information, 1, 100);
  
      scheduleTimer = new Timer();
      scheduleTimer.Interval = 10;
      scheduleTimer.Elapsed += new ElapsedEventHandler(scheduleTimer_Elapsed);;
  }
  
  protected override void OnStart(string[] args)
  {
      eventLog1.WriteEntry("Service started", EventLogEntryType.Information, 1, 100);
      flag = true;
      sw = true;
      lastRun = DateTime.Now;
      scheduleTimer.Start();
  }
  </code></pre>