title: how to have a service run at a specific time?
body: <p>Ive got a service which currently i believe is running every 10 min, but i want it to run at 7pm every day, what do i need to change? .... </p>
  
  <pre><code> private Timer _timer;
      private DateTime _lastRun = DateTime.Now;
  
      protected override void OnStart(string[] args)
      {
          _timer = new Timer(10 * 60 * 1000); // every 10 minutes??
          _timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
      }
  
      private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
      {
  
          if (_lastRun.Date &lt; DateTime.Now.Date)
          {
              // stop the timer 
              _timer.Stop();               
  
              try
              {
                  SmartImportService.WebService.WebServiceSoapClient test = new WebService.WebServiceSoapClient();
                  test.Import();
              }
              catch (Exception ex) { }
  
              _lastRun = DateTime.Now;
              _timer.Start();
          }
      }
  </code></pre>