首页 > 解决方案 > cofoundry 0.40 hangfire 管理部分

问题描述

我正在尝试使用Cofoundry.Plugins.Hangfire.EnableHangfireDashboard布尔值为 cofoundry 管理员启用hangfire仪表板

程序片段:

public class HangfireOvverideSetting : IDependencyRegistration
{
    public void Register(IContainerRegister container)
    {
        var registrationOptions = new HangfireSettings() { Disabled = false, EnableHangfireDashboard = true };
        //  container.Register<IMyService, MyService>(registrationOptions);

        // OR use the static helper

        container.Register<IHangfireServerInitializer>(RegistrationOptions.Override());
    }
}

如何在这里启用?

标签: c#hangfirecofoundry

解决方案


安装 Cofoundry.Plugins.BackgroundTasks.Hangfire NuGet包后,Hangfire 将自动注册和设置。

Hangfire 仪表板默认禁用,但要启用它,您只需要更新 appsettings.json 中的应用程序设置:

{
    "Cofoundry:Plugins:Hangfire:EnableHangfireDashboard": true
}

然后可以在您的管理站点“/admin/hangfire”中访问它。文档中的设置分隔符存在错误,但现在已修复。

您不必重写IHangfireServerInitializer来启用此功能。


推荐阅读