有没有办法在 IIS 中公开 Hangfire 而无需配置授权?
在这种特定情况下,仪表板应该打开,但在访问它时(不是在调试中)它会返回 401 代码。
我认为你应该能够编写一个自定义实现IDashboardAuthorizationFilter
如上所述在文档中 http://docs.hangfire.io/en/latest/configuration/using-dashboard.html?highlight=authentication#configuring-authorization。请注意,默认情况下仅允许对仪表板的本地请求。还建议您真正使用授权,不要发布未经授权的仪表板,因为它包含敏感信息。
如果您仍然想这样做,请尝试:
自定义 IDashboardAuthorizationFilter
public class MyAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
return true;
}
}
在hangfire的配置中使用它
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new [] { new MyAuthorizationFilter() }
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)