0
votes

I have created windows service. I need to run that automatically after 2 minutes. For that i have called System.Timers.Timer under OnStart and set the interval to 2 minutes (after converting from millseconds) and made than enabled as true

I have also made Timer Stopped and made that enabled as false in OnStop Method.

Is that ok or i'm missing anything? Let me know

thanks for your help!

1

1 Answers

3
votes

you need to setTimer.AutoReset=true after InitializedComponent() or in your OnStart function before you set Timer.Enabled = true and do remember you need to define your Timer in Class level

See Timer.AutoReset Property