I have an ASP.NET forms app that allows users to run some management reports. Some reports need to be run unattended on a schedule and I created a C# console app to run them in Task Scheduler on a server. The powers that be are adamant that there be one web based app that does it all.
How do you reliably run jobs on a schedule, say 11:00PM daily, from a web app? I see Quartz.net as an option for the scheduler, but how do you keep a web page up 24/7?
Thanks
Regardless of what the powers that be say, you shouldn’t rely on an ASP.NET app to be a scheduler. Have a dedicated service in the backend that retrieves the schedule from a shared database that the ASP.NET web app writes to (directly or via a data layer) and have it spawn the reports.
This approach
avoids reliability issues: IIS worker processes may be recycled at
any time – you would have to account for that which adds complexity.
limits possible security limitations: You would have to add certain
permissions to the IIS AppPool identity to allow spawning of these
processes. It’s better to limit the rights as much as possible to reduce the attack surface.