Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need job scheduler in asp.net

We have a website where we need a scheduler to receive notifications (e-mail) on specific time. eg. a person setting reminder at 5 PM to attend the meeting at 4:45 PM, will receive email at 4:45 PM about same.

As this site is hosted on shared server, we don't have any control over the server to run any SQL Job or scheduler application.

Is there anything in asp.net which can help in this scenario?

like image 447
ANIL MANE Avatar asked Apr 23 '09 11:04

ANIL MANE


People also ask

What is ASP Net scheduler?

The ASP.NET Web Forms Scheduler control is an event calendar that facilitates almost all basic Outlook and Google Calendar features. It allows the user to plan and manage appointments efficiently.

What is cron job in asp net?

A cron job is a Linux command used for scheduling tasks to be executed sometime in the future. This is normally used to schedule a job that is executed periodically – for example, to send out a notice every morning. Some scripts, such as Drupal and WHMCS may require you to set up cron jobs to perform certain functions.

How do I automatically run a webservice?

Probably the best option is self-hosted WCF which will allow you to serve a web-service and to run some background thread. Simplest options looks like a some command like, to be run by Task Scheduler often enough (once a minute?).


4 Answers

You need to have a job done at the server, but you have no good way of triggering it from ASP.NET?

How about creating a webpage that will start your job, and have a timer run elsewhere (ie. on another computer) that requests that page. (Just hitting the page to trigger you jobs)

like image 41
Arjan Einbu Avatar answered Nov 15 '22 08:11

Arjan Einbu


I had the same problem as you and I ended up with a programming a service that utilize Quartz.NET: http://quartznet.sourceforge.net/ and connect to the same database as the website.

like image 30
Bård Avatar answered Nov 15 '22 07:11

Bård


With ASP.NET you are not guaranteed that your app is alive at all times, and thus web applications as a host process for a scheduling solution is not feasible IMO.

A Windows service is what you need for this scenario. You have full control on starting and stopping the process as well as ways of monitoring the application.

Are you able to host such a service on a different machine? Even if the web application is running on a hosted server doesn't mean you have to run the scheduler on the same server.

like image 41
Peter Lillevold Avatar answered Nov 15 '22 07:11

Peter Lillevold


How about this: Simulate a Windows Service using ASP.NET to run scheduled jobs.

At one point this technique was used on Stack Overflow, although I don't think it is any more.

To be honest it seems like a nasty, error-prone hack to me, but if you're unable to run anything on the server except your website then something like this is probably your only option.

like image 175
LukeH Avatar answered Nov 15 '22 07:11

LukeH