无论我使用什么计划,都不会触发我在Hangfire中进行的定期工作。我试图使用它BackgroundJob只是为了确保某些东西可以正常工作。我还检查了数据库,并使用计划的作业正确填充了“哈希”表。
这是我正在使用的代码:
try
{
using(var server = new BackgroundJobServer(serverOptions,storage))
{
Log("Hangfire server started");
RecurringJob.AddOrUpdate("Mail", () =>
_notificationHelper.SendEmail(result)
, Cron.MinuteInterval(1), TimeZoneInfo.Local
);
//BackgroundJob.Enqueue(() => _notificationHelper.SendEmail(result));
}
}
Run Code Online (Sandbox Code Playgroud)
那我在做什么错呢?