本地可以正常打开hangfire页面,发布后报401
作者:互联网
解决办法
增加
CustomAuthorizeFilter
:
public class CustomAuthorizeFilter : IDashboardAuthorizationFilter { public bool Authorize([NotNull] DashboardContext context) { return true; } public CustomAuthorizeFilter() { } }新增类
Configure
增加配置,代码也可以其他地方,用下面代码替换原先 app.UseHangfireDashboard() 即可。
:
app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new CustomAuthorizeFilter() } });
标签:CustomAuthorizeFilter,app,hangfire,后报,401,new,UseHangfireDashboard,public 来源: https://www.cnblogs.com/xbding/p/15099942.html