Run Windows Service after particular time
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
开发者_JS百科thanks for your help!
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
精彩评论