0

Possible Duplicate:
Windows Service - How to make task run at several specific times?

I need advice for which my Windows service should to be run by specifically as per timing example at 9.30am, 11.30am, 2pm, 3.45pm, and 5.45pm only, how can I achieve this in using Windows service only, I am using .net framework 3.5, I got a sample kind off but it is useful for the .NET framework 4

Windows Service - How to make task run at several specific times?

But I need sample for .NET framework 3.5, please advice

Community
  • 1
  • 1
user1702625
  • 19
  • 1
  • 7
  • @JulienLebosquain off course yes, the function which were used framework 4, i am working on 3.5, thats the i have clearly mentioned as i need particularities for 3.5 fw – user1702625 Oct 11 '12 at 07:32
  • 2
    Please have a look at the answer mentioning Quartz.net and CronTrigger, they are not .NET 4 specific at all. – Julien Lebosquain Oct 11 '12 at 07:37

3 Answers3

1

Don't use a service for this. Use Windows Task Scheduler.

Remy
  • 12,555
  • 14
  • 64
  • 104
  • asper the requirement i need to use the logic only in .net – user1702625 Oct 11 '12 at 07:37
  • 1
    as suggested you don't need to build windows service. Create a console application for any .NET version you require, which executes what you want to do periodically and use windows task scheduler. It is possible using windows service but your application would be using resources constantly while it only needs to do stuff at specific times – Kamil Krasinski Oct 11 '12 at 07:55
1

First of all why do you want to use windows service if your requirement is to run only on specific times. Windows service is generally used when you need your program to run continuously in background. May be to monitor a queue or wait for an event to trigger etc.

As mentioned in the previous answer, create a console application and schedule it using Windows Scheduler.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Taher
  • 732
  • 1
  • 9
  • 26
0

Use System.Timers.Timer and System.Threading.Timer . Link below will be helpful :

Best Timer for using in a Windows service

Community
  • 1
  • 1
  • 1
    walid ali, thanks for prompt reply,above link share will help continous running service n number of times polling, but here i need only service it should for the mentioned timing only – user1702625 Oct 11 '12 at 07:35