Windows Service - C#
How can I ru开发者_JS百科n a Windows-Service hourly?
Or just write a simple app and use the systems Task Scheduler Service to run your app every hour - no need to write a service at all this way.
Based on the description of your problem (which only superficial) I can't think in anything else other than the use of the normal service template provided by VS to create a service and use a Timer to trigger the method that you are interested in running every hour.
About Timer you can also check it out here
For some more info about how to create the service, in can have a look in the msnd web site
As a simple rule of thumb, never forget to disable the timer just before you starting processing your staff and enable it again at the end
well you can create a service which works at a time interval of 60 minutes
timer1 = new Timer();
this.timer1.Interval = 1000 * 60* 60;
this.timer1.Elapsed += new ElapsedEventHandler(timer1_Elapsed);
timer1.Enabled = true;
write this code in the onstart method of the windows service and you will be able to run the service in hourly manner.
精彩评论