Quartz.net:计划code部署后不工作自动完成,在本地工作工作、自动完成、计划、Quartz

2023-09-05 03:10:34 作者:疯妹子

我希望在预定的时间表(每周一次),从我的MVC网站发送电子邮件。通过Visual Studio在本地运行时,code是工作完全正常的预定时间。然而,没有得到部署到服务器后触发

I wish to send an email in a scheduled timeline (once in a week) from my MVC website. The code is working perfectly fine on the scheduled time when running through Visual Studio locally. However, not getting triggered after deployment to the server.

它开始工作时,我在部署后打的网站一次,作为Applciaiton_Start事件被炒鱿鱼,​​我触发石英引擎。

It starts working when I hit the website once after deployment,as the Applciaiton_Start event gets fired where I trigger the Quartz engine.

有没有办法通过它我可以触发引擎无需访问网站甚至一度。石英是否总是以这种方式工作,你必须打一次应用程序。

Is there a way by which I can trigger the engine without visiting the website even once. Does Quartz always work this way, that you have to hit the Application once.

推荐答案

没有,你不能。 Quartz.net,在你的情况,你的生活的应用程序中。 当应用程序池被回收的调度死亡。

No, you can't. Quartz.net, in your situation, lives inside your application. When the Application Pool gets recycled your scheduler dies.

这是不是与Quartz.Net但IIS和它管理的应用程序池的方式有问题。

This is not a problem with Quartz.Net but IIS and the way it managed the application pool.

我想最好的选项,供您是使用调度程序的 Windows服务。

I guess the best option for you is to use the scheduler in Windows Service.

另一种选择是创建一个简单的应用程序(控制台),并通过系统任务调度程序运行它。使用这个选项,你可能想摆脱Quartz.Net的。

Another option is to create a simple application (console) and run it through the System Task Scheduler. With this option you might want to get rid of Quartz.Net.

第三个选择是使用一些外部服务如正常运行时间机器人或的 Pingdom的。我不会选择这个选项,但它是一种可能性。

Third option is to keep your application alive using some external service like Uptime Robot or Pingdom. I wouldn't choose this option but it's one possibility.

如果你打算为第三选项我会建议你使用的作业存储所以你可以坚持你的工作在数据库中,你千万不要错过了火灾。

If you're going for the 3rd option I would advice you to use the JobStore so you can persist your job in a database and you don't miss the fires.