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