在CentOS 7上部署后,hangfire周期性作业无法正常工作

时间:2019-02-20 06:08:06

标签: hangfire

在CentOS 7上发布我的ASP.NET Core 2.2之后,我陷入了Hangfire周期性工作问题。

它在开发机上正常工作。

public void ConfigureServices(IServiceCollection services)
{
        ConnectionString.Hangfire = Configuration.GetConnectionString("Hangfire");

        services.AddHangfire(_ => _.UseSqlServerStorage(ConnectionString.Hangfire));

 services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddSerilog();

            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });

            app.UseAuthentication();

            app.UseHangfireDashboard();
            app.UseHangfireServer();

            RecurringJob.AddOrUpdate(() => ScheduledTasks.Minutely_Tasks(), Cron.Minutely());


            app.UseHttpsRedirection();
            app.UseMvc();
        }

public static async Task<bool> Minutely_Tasks()
        {
            try
            {
                ClsMain.SaveErrorLog("ScheduledTask MINUTE");
            }
            catch (Exception ex) { ClsMain.SaveErrorLog("ScheduledTasks.Minutely_Tasks: " + ex.ToString()); }
            finally { }
            return await Task.FromResult(true);
        }

我错过了什么?

非常感谢

问候 唐

0 个答案:

没有答案