Reputation: 9
Is it possible to have cron job in asp.net application. Here is what I want to implement:
"If there are 50 new users then send me newsletters according to their needs"
I have done this by creating a console application running on server but I am looking if there is a way like cron jobs?
Thanks
Upvotes: 0
Views: 4644
Reputation: 217
The equivalent of cron-jobs in windows is either task scheduler, or a windows service.
In my opinion, you can go with a windows service that polls the db, and sends the newsletter.
If you already built the console app, extract the relevant code in a BusinessLogic Class, and create a new Windows Service project. See http://code.msdn.microsoft.com/windowsdesktop/CSWindowsService-9f2f568e I'm guessing you already have a working SMTP server to which you can connect from the server,right?
see also answers to this StackOverflow question
Upvotes: 0
Reputation: 7126
Take a look at Quartz.net, it can easily handle cron triggers
http://www.quartz-scheduler.net/
http://quartznet.sourceforge.net/tutorial/index.html <-- Very useful for gettng started
Upvotes: 2
Reputation: 83709
You could run the windows task scheduler that would take a command similar to a cron job.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx
Upvotes: 2