I am looking into using Quartz.NET on a ASP.NET app. Is this possible?
I know that the worker process on IIS gets recycled once in a while.
Will this affect Quartz?
Thanks in advance
Andre' Oliveira
If you place your initialization of Quartz.NET to Application_Start
event in Global.asax it should be checked whenever application is
restarted. Of course this event will be raised _after_ the first
request to your application which could mean that on low traffic site
the Quartz.NET might not be initialized even daily.
For a foolproof solution I would use Windows Service to run these
maintenance tasks on the same box. Another option if you have IIS 6.0
you can set recycling time to some other value like none. Note that by
default IIS recycles every 1740 minutes which isn't 24 hours and might
cause confusion in production. I would advice to set this to some
other value like something occurring only nightly and at certain time.
-Marko
On May 14, 2:12 pm, "Marko Lahma" <marko.la...@gmail.com> wrote:
> Hi Andre',
>
> If you place your initialization of Quartz.NET to Application_Start
> event in Global.asax it should be checked whenever application is
> restarted. Of course this event will be raised _after_ the first
> request to your application which could mean that on low traffic site
> the Quartz.NET might not be initialized even daily.
>
> For a foolproof solution I would use Windows Service to run these
> maintenance tasks on the same box. Another option if you have IIS 6.0
> you can set recycling time to some other value like none. Note that by
> default IIS recycles every 1740 minutes which isn't 24 hours and might
> cause confusion in production. I would advice to set this to some
> other value like something occurring only nightly and at certain time.
>
> -Marko
>
I'm afraid there is no silver bullet for this at least that I'm aware
of. ASP.NET can recycle process when it sees fit and thus making it
quite difficult to make sure that background tasks are kept alive as
wished.
You could design your application to tolerate this (jobs are run if
misfired a bit later - better than nothing) and run a external program
that pings the server in certain interval to make sure that ASP.NET
process is running - a simple wget or similar.
ASP.NET is not very friendly for background services. There's an
article on code project:
http://www.codeproject.com/aspnet/ASPNETService.asp
But this solution is hackish to say the least and I would generally
recommend against using ASP.NET model to something that it wasn't
designed for. It's for request-response processing.
Cheers,
-Marko