1

Is there an implementation of a Windows service that can call custom .NET code that can be scheduled to run on specific intervals?

Or should I implement my own (which I am currently doing), but I think it's better not to reinvent the wheel :)

I don’t want to use Windows Task Scheduler.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Karim
  • 6,113
  • 18
  • 58
  • 83
  • Why don't you want to use the Windows scheduler? Given that the scheduler meets the requirements you've stated so far, more explanation will help us find a better fit. – Michael Petrotta Nov 07 '09 at 19:35
  • Could you share the reason not to use the Windows Task Scheduler? The reasons may be good input for providing good answers. – Fredrik Mörk Nov 07 '09 at 19:35
  • I'm a little confused if you are trying to execute an application at a specified interval, or call a function. – jheddings Nov 07 '09 at 19:38
  • i dont want to use the windows shedular because i need more timing then is available in the schedular "like run every 30 seconds" also i want the configuration of the schedul to be saved in the application so i can redeploy it later. i want to call a function because calling an application will introduce some not needed overheads – Karim Nov 07 '09 at 19:50

3 Answers3

3

If you are just looking to call a function periodically, use System.Threading.Timer. Using this, it would be easy to write a simple service that performs whatever tasks you want at your chosen intervals.

A good library for scheduling jobs is Quartz.NET. You can either run it as a stand-alone application, or as a part of your own application. It has a very good API with many features out of the box. There is also a tutorial to get you started. It is a port of the Java Quartz scheduling framework.

If you are looking for a replacement to the Windows Scheduler, try VisualCron. It's not free, but it has many features.

jheddings
  • 26,717
  • 8
  • 52
  • 65
  • 1
    actually i am in the process of writing one right now but thought its better to use some open source project if its available – Karim Nov 07 '09 at 19:52
  • Updated answer to include Quartz.NET. Definitely check it out. – jheddings Nov 07 '09 at 20:16
  • quartz.net is nice but its too complex for my needs. so i think i will implement my own scheduling service :) – Karim Nov 08 '09 at 14:08
0

It's better to develop your own Windows service application. It should not take much effort with Visual Studio. Surely you will find a sample application at MSDN or on the web.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Saar
  • 8,286
  • 5
  • 30
  • 32
  • actually its not very easy since i need to handle advanced scheduling timing options. like run on the minute 07 every hour and repeat for 10 minutes and so on – Karim Nov 07 '09 at 19:51
0

Try something like Writing a Useful Windows Service in .NET in Five Minutes [Dave Fetterman].

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Beached
  • 1,608
  • 15
  • 18