title: Error 1053 the service did not respond to the start or control request in a timely fashion
body: <p>I have created and installed a service a couple of times. Initially it was working fine, but after some changes in the service Code it start giving the error when I restart the service in Services.msc :</p>
  
  <blockquote>
    <p>Error 1053: the service did not respond to the start or control request in a    timely fashion</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>public partial class AutoSMS : ServiceBase
  {
      public AutoSMS()
      {
          InitializeComponent();
          eventLog1.Clear();
  
          if (!System.Diagnostics.EventLog.SourceExists("MySource"))
          {
              System.Diagnostics.EventLog.CreateEventSource(
                  "MySource", "MyNewLog");
          }
          eventLog1.Source = "MySource";
          eventLog1.Log = "MyNewLog";
  
          Timer checkForTime = new Timer(5000);
          checkForTime.Elapsed += new ElapsedEventHandler(checkForTime_Elapsed);
          checkForTime.Enabled = true;
  
      }
  
      protected override void OnStart(string[] args)
      {
          eventLog1.WriteEntry("In OnStart");
      }
  
      protected override void OnStop()
      {
          eventLog1.WriteEntry("In onStop.");
      }
  
  
      void checkForTime_Elapsed(object sender, ElapsedEventArgs e)
      {
          string Time = "15:05:00";
          DateTime dateTime = DateTime.ParseExact(Time, "HH:mm:ss",
                                          CultureInfo.InvariantCulture);
  
          if (DateTime.Now == dateTime) ;
              eventLog1.WriteEntry(Time);
      }
  }
  </code></pre>
  
  <p>Here is my main method code</p>
  
  <pre><code>static void Main()
  {
      ServiceBase[] ServicesToRun;
      ServicesToRun = new ServiceBase[] 
      { 
          new AutoSMS() 
      };
      ServiceBase.Run(ServicesToRun);
  }
  </code></pre>
  
  <p>I also tried the following steps :</p>
  
  <ul>
  <li>Go to Start > Run > and type regedit</li>
  <li>Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control</li>
  <li>With the control folder selected, right click in the pane on the right and - select new DWORD Value</li>
  <li>Name the new DWORD: ServicesPipeTimeout </li>
  <li>Right-click ServicesPipeTimeout, and then click Modify</li>
  <li>Click Decimal, type '180000', and then click OK</li>
  <li>Restart the computer</li>
  </ul>
  
  <p>I used to install and uninstall it with following command :</p>
  
  <pre><code>installutil AutoSMS.exe
  
  installutil /u AutoSMS.exe
  </code></pre>