如何从 hangfire 仪表板手动触发作业

问题描述 投票:0回答:0

我在 .net 核心项目上使用 hangfire,(vs:1.7.34) 我想从 hangfire 仪表板 UI 触发重复作业,之前有一个按钮显示“立即触发”但现在不显示触发按钮,我猜可能是在我升级 hangfire 版本之后。如何启用它并手动从仪表板触发作业?

tihs之类的设置;

public static class HangfireHelper
{
    public static void AddHangfire(IServiceCollection services, string connectionString, string recurrence)
    {
        services.AddHangfire(x =>
        {
            x.UsePostgreSqlStorage(connectionString);
            RecurringJob.AddOrUpdate<MyClass>(e => e.MyMethodToExecute(), recurrence);
        });

        services.AddHangfireServer(ops =>
        {
            ops.ServerName = "my job server";
            ops.WorkerCount = 10;                
            ops.Queues = new string[] { "general" };
            ops.SchedulePollingInterval = TimeSpan.FromSeconds(10);
            ops.CancellationCheckInterval = TimeSpan.FromSeconds(10);
        });

    }
}
.net-core dashboard hangfire
© www.soinside.com 2019 - 2024. All rights reserved.