Question

I have a long running task (many hours) that is started via a web page on an intranet interface. This is an ASP.Net 3.5 project. Of course, I could extend the script timeout and let the page run for several hours, but I don't think this is a clean solution. I read somewhere that long running tasks should not be children of a Web Application Pool, since it could be reset by IIS at any time. Searching for a solution, I read a bit about Quartz.Net, but most examples are talking about recurring jobs. I was wondering if it were also appropriate for tasks that should run only once when a user asks for it. Or is there another better solution?

Also, if Quartz.Net is a good way to go, should it run as a Windows Service, or should it be spawned by the ASP.Net web site using Global.asax?

Was it helpful?

Solution

Quartz.net works just fine for this scenario. You schedule a one time job on Quartz.net and let it run for as long as it needs to. At work this is exactly how we run many of our jobs.

You should set up Quartz.Net as a windows service though. IIS recycles web apps and if you run Quartz.net within your web app it will get recycled along with you web app by IIS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top