title: C# Windows Service Timers not Firing
body: <p>I am using a <code>System.Threading.Timer</code> in Windows service to execute a method periodically.
  The timer fires only once, it does not fire. Can anyone please help.</p>
  
  <p>Below is the code</p>
  
  <pre><code>private TimerCallback timerDelegate;
  
  protected override void OnStart(string[] args)
  {
      timerDelegate = new TimerCallback(DoWork);
      serviceTimer =  new Timer(timerDelegate, null, 1000,Timeout.Infinite);
  }
  
  private void DoWork(object state)
  {
      GetMessages();
  }
  </code></pre>