3

我已经为我的 Web API 解决方案配置了 Hangfire。但是在一段时间记录停止信号后,Hangfire 停止工作。但是,如果再次使用 API,它会加载并正常工作。Hangfire 停止前产生的日志如下。我应该怎么做才能防止这种情况发生。

[137] INFO Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 捕捉到停止信号... [ServerWatchdog #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 ServerWatchdog:32e9252b 在 2.2406 毫秒内停止 [ExpirationManager #1] 调试 Hangfire .Processing.BackgroundExecution - 执行循环 ExpirationManager:802eb676 在 2.2681 毫秒内停止 [Worker #3] DEBUG Hangfire.Processing.BackgroundExecution - 执行循环 Worker:3d798436 在 2.4496 毫秒内停止 [CountersAggregator #1] DEBUG Hangfire.Processing.BackgroundExecution - 执行循环 CountersAggregator :f6091560 在 3.1411 毫秒内停止 [Worker #2] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 Worker:8b960c88 在 3.7784 毫秒内停止 [Worker #2] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 Worker:8b960c88 在 3 中停止。7784 毫秒 [Worker #4] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 Worker:8e0e3cc8 在 4.2624 毫秒内停止 [DelayedJobScheduler #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 DelayedJobScheduler:066c3859 在 4.5509 毫秒内停止 [136] INFO Hangfire。 Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 捕获停止信号... [Worker #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 Worker:dfcd3314 在 5.7981 毫秒内停止 [RecurringJobScheduler #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 RecurringJobScheduler:2b8e4675 在 6.1803 毫秒内停止 [ServerJobCancellationWatcher #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 ServerJobCancellationWatcher:554692cc 在 6.216 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server。BackgroundServerProcess - 服务器 xyz:26756:c4da0558 所有调度程序已停止 [ServerHeartbeatProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 ServerHeartbeatProcess:f3cc4077 在 8.3409 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558正在报告自己已停止... [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 在 199.8624 毫秒内成功报告自己已停止 [BackgroundServerProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 BackgroundServerProcess: dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒c4da0558 所有调度程序已停止 [ServerHeartbeatProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 ServerHeartbeatProcess:f3cc4077 在 8.3409 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 报告自己已停止。 . [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 成功报告自己在 199.8624 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒c4da0558 所有调度程序已停止 [ServerHeartbeatProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 ServerHeartbeatProcess:f3cc4077 在 8.3409 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 报告自己已停止。 . [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 成功报告自己在 199.8624 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒BackgroundExecution - 执行循环 ServerHeartbeatProcess:f3cc4077 在 8.3409 毫秒内停止 [BackgroundServerProcess #1] DEBUG Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 报告自己已停止... [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器xyz:26756:c4da0558 成功报告自己在 199.8624 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756 :c4da0558 总共停止了 212.7921 毫秒BackgroundExecution - 执行循环 ServerHeartbeatProcess:f3cc4077 在 8.3409 毫秒内停止 [BackgroundServerProcess #1] DEBUG Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 报告自己已停止... [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器xyz:26756:c4da0558 成功报告自己在 199.8624 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire.Processing.BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756 :c4da0558 总共停止了 212.7921 毫秒BackgroundServerProcess - 服务器 xyz:26756:c4da0558 报告自己已停止... [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 成功报告自己在 199.8624 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire。 Processing.BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒BackgroundServerProcess - 服务器 xyz:26756:c4da0558 报告自己已停止... [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 xyz:26756:c4da0558 成功报告自己在 199.8624 毫秒内停止 [BackgroundServerProcess #1] 调试 Hangfire。 Processing.BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒BackgroundExecution - 执行循环 BackgroundServerProcess:dd1eaf65 在 214.6647 毫秒内停止 [BackgroundServerProcess #1] INFO Hangfire.Server.BackgroundServerProcess - 服务器 virtuadeskdev04:26756:c4da0558 总共停止了 212.7921 毫秒

4

1 回答 1

2

这是因为应用程序池空闲设置为 20 分钟。我已将开始类型更改为 始终运行,现在 Hangfire 不会停止。

于 2019-05-28T07:00:52.913 回答