Liunx下部署hangfire无法打开面板

若没有hangfir面板的过滤器IDashboardAuthorizationFilter,在打开/hangfire路径时请求会返回401未授权。
需要添加类继承IDashboardAuthorizationFilter过滤器类

    public class CustomerHangfireDashboardFilter : IDashboardAuthorizationFilter
    {
        public bool Authorize([NotNull] DashboardContext context)
        {

            return true;
        }
    }

并且在StartUp注册使用
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
//hangfire 身份验证过滤器
Authorization = new[] { new CustomerHangfireDashboardFilter() },
});

猜你喜欢

转载自blog.csdn.net/qq_30174147/article/details/107708207