Max
Max

Reputation: 31

How the web application to achieve the schedule task on a shared host?

As far as I know, the quartz.net scheduler is started in the global.asax. That's to say, quartz.net scheduler does not work unless someone visits the website. This is not a safe way because the scheduler thread can be killed by rebooting server or the process in the IIS pool being terminated, and the scheduler thread will remain unstarted until someone visits the website again.

We could use windows scheduler to solve this problem. But we are using a shared host and we cannot write a service or a sql server job or schedule a windows task on the host.

If we are sure that our site be visited every day, this is not a problem. If not, how can we ensure that the web scheduler work all the time even if no one visit our site for days and even if the server is rebooted?

Upvotes: 3

Views: 348

Answers (2)

jvilalta
jvilalta

Reputation: 6789

You should install quartz.net as a windows service and access it from your web app via remoting. This will guarantee that the scheduler is always running. Instructions for setting up the scheduler as a windows service are here: Getting Started with Quartz.Net Part 1

Upvotes: 2

Neil Thompson
Neil Thompson

Reputation: 6425

The easiest way is to get have a Scheduled Task on the server trigger your job (by requesting the page). If you don't have a server that can do this you can use something like pingdom to hit a page at n intervals.

If you do have a server to do this you can also write a service - but for something trivial I'd just use a scheduled task.

Upvotes: 1

Related Questions