Alex Rivera | Logout

How to emulate cron jobs on a Windows Server?

Asked 2009-05-11T23:45:16.640
11

I'm running .NET on a windows box and I would like to have a function run every night at midnight. Of course since HTTP stateless and Windows doesn't have a "cron job" type function (that I know of), I will either have to visit my site myself every night at midnight or just wait for a user to visit the site to rely on it being updated.

Is there an alternative to this that I can create where something will automatically run at a certain time?

Edit
Report

2 Answers

1

you can also take a look at Quartz .Net http://quartznet.sourceforge.net/ which is a scheduler

answered 2009-05-12T01:26:50.217
0

Use the Timer class to create a timer that periodically calls a method to be executed.

A static timer can be started in the Application_Start event in the Global class. Because the timer uses an interval rather than an absolute time, you'll have to calculate the time interval until midnight and set the Interval property accordingly.

answered 2009-05-12T00:09:12.573

Your Answer