- 本地可以正常打开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() } });
- hangfire 关键任务表
select [Key] from [dbo].[Hash] group by [Key];
select * from [dbo].[Set];