问题描述
当我登录服务器并打开仪表板时,它显示了过去执行下一次执行的重复作业.在几秒钟内,它会自动触发对它们的处理,但是,如果我不登录并打开仪表板,则不会触发重复作业.
When I log into the server and open dashboard, it shows recurring jobs with the next execution in the past. Within seconds it triggers processes them automatically, but if I don't log in and open the dashboard, the recurring jobs are not triggered.
Hangfire似乎正在按预期方式运行并正在处理作业.
如果没有我看,为什么它不会触发?
It appears that Hangfire is running as expected and processing jobs.
Why will it not trigger without me looking at it?
推荐答案
如果Hangfire服务器在 Web应用程序中运行,这是一个常见问题.未触发作业,因为Web服务器由于用户不活动而停止了该应用程序.
It's a usual problem if a Hangfire server runs in a web application. The jobs are not triggered because the web server has stopped the app due to user inactivity.
阅读文档以防止出现这种情况:使ASP.NET应用程序始终运行.
Read the docs to prevent it: Making ASP.NET application always running.
另一种解决方案是将Hangfire服务器从Web应用程序迁移到控制台应用程序或Windows服务.
Another solution is to migrate your Hangfire server from a web application to a console app or a windows service.
这篇关于除非打开仪表板,否则Hangfire不会处理周期性作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!