How to emulate cron jobs on a Windows Server?

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?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’m pretty sure that Windows’ task scheduler can do most things that cron can do. But I might be missing something.

Edit: Reached at Settings -> Control Panel -> Scheduled Tasks

Method 2

If none of the other answers work for you, here’s an option:

There are a bunch of server monitoring services out there that will make an http call to your site at regular intervals (every minute if you like). You can get 5 minute intervals for free on some of them.

Create a password protected page, that performs your function (if it hasn’t been done yet today) and point that service at it.

At least this way you won’t have to write anything additional, and you can rest easy knowing it doesn’t rely on your home machine.

Method 3

Jeff Attwood at some point in the podcast mentioned a dirty hack to use the Cache Expiration Callback to fake this.

He’d insert an item in .Net’s Cache, with an expiration set to 2 hours, and a callback to get called once the item expired, and that was his cron.

I think this was the article:

It sucks if you ask me, but for a shared hosting solution, I can’t think of anything much better.

Also, there are external cron services that you give a URL to and they will “ping” it regularly, like: (these are not free)

Method 4

Here’s a starting point to programmatically add/delete and manage tasks in the Task Scheduler.

Method 5

If you have command-line access you could try the “at” command, which is like an ultra-light cron:

Method 6

you can also take a look at Quartz .Net which is a scheduler

Method 7

The windows equivalent of cron is At. If you have access to the machine.

Method 8

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.

Method 9

It looks like GoDaddy has provisions for this, but There Is More Than One Way To Do It:
When you install Drupal it needs you to set up a cron job, and I’ve found out that the project members have documented this step throughly. Go to for more information, and remember to read for specific Windows information.
If everything else fails, google for “web cron job” and use a commercial “cron job” service. Choose carefully, don’t get ripped off.

Method 10

I’m also facing the same issue. I want to run ASP.NET with MSSQL at GoDaddy. But they don’t have scheule task for windows hosting. After reading the post, I did my own google and found this free web cron job scheduler:

I just tried and it works perfectly…well almost. The job expires in 1 year.

Hope it helps.

Method 11

Searching for an answer to the same question, I found this post (quartz-net-with-asp-net) with setup instruction for Quartz.NET (“Enterprise Job Scheduler for .NET Platform”, from their website) even from inside an ASP.NET application.

Added it here mainly for reference.

Method 12

Why not install cygwin and use cron itself?

here is a pdf guide on setting it up:

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x