how to start/run a windows service at particular time (say: 12:00 PM) every day?
Background: I have developed a windows service which runs once every day and does the work (every thing is just right!)
Issue: the service runs exactly at the same time (last run time) the other day.. Ex: If I start the service at 4:00 PM today so it will run again at 4:00 PM every day.
My solution till yet (but not working fine) I want it to configure it self with the StartTime and IntervalTime mentioned in the app.config file and run at that time everyday (regardless of when I have started it)
开发者_JAVA技巧Having problems with this silly thing .. Please help in this regards with sample code. Your help is really appreciated, Thanks in advance.
For further clarification, if I have mentioned in app.config
key="StartTime" value="12:00"
key="Interval" value="86400000"
so it must run on 12:00 PM every day (as interval period is 86400000 milliseconds i.e. 1day) regardless of the time when I started it or make it live.
You could set up a scheduled task that starts the service at a specific time and stops it at another via a batch file. You would utilize the commands net stop myservice
and net start myservice
in the batch file.
精彩评论