Cannot keep alive Web Application on IIS after Recycling or Restarting

烂漫一生 提交于 2019-11-28 01:41:00
LeftyX

You do not mention in your question where your application is going to run so I guess it's going to be hosted in-house.

Following your comment I gather you do not have any problems installing and running a Windows Service on your server.

My suggestion - and something I've implemented in the past - is to use the ASP.NET MVC application only as a UI where you create, delete or suspend your jobs/triggers which will be persisted in a database so, whatever happens to your application, you won't lose your jobs/triggers and they will be executed as soon as the application goes back on-line.

The database will be shared with the other layer, the Windows Service, which will be responsible for running your scheduled jobs.

First step is to setup and use AdoJobStore to store Quartz.Net data. As you can see in the post there are a few providers you can use.

Second step is to create and configure your Windows Service. I would use TopShelf to host it. The implementation is very simple and straightforward; plus you can use the Quartz.Net integration provided here.

If you go through the documentation you won't find any problem integrating the solution.

Quartz.Net depends on some configuration you have to add in your app.config/web.config. In this answer there's a detail explanation about the configuration and AdoJobStore.

There are a few things to remember implementing this type of solution.
Your Web Application is going to set the property threadPool to ZeroSizeThreadPool in your config:

<add key="quartz.threadPool.type" value="Quartz.Simpl.ZeroSizeThreadPool, Quartz" />

or in your code:

properties["quartz.threadPool.type"] = "Quartz.Simpl.ZeroSizeThreadPool, Quartz";

and it's never going to start the Scheduler (your windows service is going to use that).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!