1

I am working on a couple of projects now where I really wish there was some sort of component that I could specify a time and date, and then execute some sort of method.

DateTime date = new DateTime(x,x,x,x,x,x);
ScheduledMethod sMethod = new ScheduledMethod(date, [method delegate of some sort]);

\\at the specified date, sMethod invokes [method delegate of some sort]

I know that I can do this with Windows Workflow Foundation as a long running process, which is good for certain things, but are there any alternatives? Workflow is not exactly straight forward with the details, and it would be nice to be able to deploy something more simple for light weight tasks. An example would be a method that checks a network folder once a day and deletes any files that are more than 30 days old. I realize that this may be pie in the sky dreaming, but this would be extremely useful for automating certain mundane maintinence tasks (scheduled sql operations, file system cleansing, routine email sending, etc.). It does not necessarily have to be .Net, but that is where I am coming from. Any ideas?

1
  • Windows Services should be applications that must run all the time. Scheduled tasks should be applications that run only for a short time sometime in the future. This is most properly handled by a scheduled task.
    – user1228
    Jan 14, 2011 at 14:58

4 Answers 4

3

try windows task scheduler. write a program in C# that performs the desired task and then schedule it in task scheduler to run at specified intervals. for things like deleting files from a folder this works very well.

3

You could deploy a Windows Service or a Windows Scheduled Task.

Also, see this SO question.

2

I typically make a console application for the task and configure it as a scheduled task in Windows. That usually works out perfectly fine. Add some decent logging to the application so you can troubleshoot in a simple manner if anything goes wrong.

1

Microsoft has Task Scheduler interface for unmanaged code http://msdn.microsoft.com/en-us/library/aa383614(v=VS.85).aspx. However if you need managed library you can use wrapper around Microsoft Task Scheduler http://www.codeproject.com/KB/cs/tsnewlib.aspx or enterprise job scheduler for .NET QuartzNet.

1
  • Quartz.NET has been fantastic in my use. Feb 2, 2011 at 1:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.