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() },
});

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章