问题描述
是否有一种无需配置授权即可在IIS中公开Hangfire的方法?
Is there a way to expose Hangfire in IIS without having to configure authorization?
在这种特定情况下,仪表板应该处于打开状态,但是在访问它时(不在调试中)它将返回401代码.
In this specific case the dashboard should be open, but when accessing it (not in debug) it returns a 401 code.
推荐答案
我认为您应该能够按照文档中的.请注意,默认设置是仅允许对仪表板的本地请求. 还建议您真正使用授权,并且不要发布未经授权的仪表板,因为它包含敏感信息.
I think you should be able to write a custom implementation of IDashboardAuthorizationFilter
as described in the documentation. Be aware that the default is only local requests to the dashboard are allowed. It's also recommended that you really use authorization and do not publish unauthorized dashboards as it contains sensitive information.
如果您仍然想要这样做,请尝试:
If you still want to do it, try:
自定义DashboardAuthorizationFilter
public class MyAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
return true;
}
}
在hangfire的配置中使用它
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new [] { new MyAuthorizationFilter() }
});
这篇关于不使用身份验证即可进行Hangfire的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!