title: Windows could not start service on Win Server 2008 R2 SP1 (Error 1053)
body: <p>This issue seems to be widely discussed, but I have problems with finding the solution in my particular case. </p>
  
  <p>My service is set up to be running under <code>Local System</code> account. On my first machine with <em>Windows 7 SP1 (64-bit)</em> installed, everything works as expected. But, just after I try to start the service on my second machine with <em>Windows Server 2008 R2 SP1 (64-bit)</em>, not even a second passes, and I'm facing this annoying error: </p>
  
  <pre><code>Windows could not start the ProService service on Local Computer
  Error 1053: The service did not respond to the start or control request in a timely fashion
  </code></pre>
  
  <p>The <code>System Log</code> shows 2 entries: </p>
  
  <pre><code>The ProService service failed to start due to the following error: 
  The service did not respond to the start or control request in a timely fashion.
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>A timeout was reached (30000 milliseconds) while waiting for the ProService service to connect.
  </code></pre>
  
  <p>The implementation looks following:</p>
  
  <p><strong>Program.cs:</strong></p>
  
  <pre><code>static void Main()
  {
      AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
      ServiceBase.Run(new ServiceBase[] { new ProService() });
  }
  
  static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
  {
      if (e != null &amp;&amp; e.ExceptionObject != null)
      {
          Logger.Record(e.ExceptionObject);
      }            
  }
  </code></pre>
  
  <p><strong>ProService.cs:</strong></p>
  
  <pre><code>public ProService()
  {
      InitializeComponent();
  }
  
  protected override void OnStart(string[] args)
  {
      try
      {
          RequestAdditionalTime(10000);
          FireStarter.Instance.Execute();
      }
      catch (Exception e)
      {
          Logger.Record(e);
          throw;
      }            
  }
  </code></pre>
  
  <p>The <code>OnStart</code> method is just starting a new thread, so it takes almost NO time load to execute. I used <code>RequestAdditionalTime</code> statement just in case - to reject this matter as a source of my problem. In addition, as you can see, I'm handling all of the exceptions, but no exception is written to my custom service event log during the startup (btw: logging is working on the first win7 machine). How to investigate what's going on ?</p>