当我试图访问我的本地IIS上域/ hangfire /的hangfire仪表板时,我得到了一个404响应。这是一个webforms项目,目标是.Net 4.5.1,Hangfire是1.5.3版本。我的启动和授权覆盖类如下:
[assembly: OwinStartup(typeof(MyNamespace.Startup))]
namespace MyNamespace
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("MyConnString");
DashboardOptions opts = new DashboardOptions
{
AuthorizationFilters = new[] { new AuthorisationOverride() }
};
app.UseHangfireServer();
app.UseHangfireDashboard("/hangfire", opts);
}
}
}
public class AuthorisationOverride : Hangfire.Dashboard.IAuthorizationFilter
{
public bool Authorize(IDictionary<string, object> owinEnvironment)
{
return true;
}
}作业正在成功运行,但我已经没有办法让仪表板正常工作了。
发布于 2016-03-09 04:01:04
我也有类似的东西,但我通过阅读这个post设法解决了它。
如果你还没有的话,希望你能有一个更好的运气。对我来说,主要的问题是DLL丢失,然后是从TemporaryASP.NET文件夹中删除站点数据。
编辑:有人对这个答案投了反对票,因为我使用了一个解决方案的链接。
既然我确实找到了这个特定问题的解决方案,我想我会再试一次分享它。:)
以下是我为找到解决方案而采取的步骤。
发布于 2017-02-22 03:58:13
今天我在这个问题上挣扎了几个小时,并在我的项目中解决了这个问题。
尝试在Startup类的Configuration方法中将Hangfire配置代码移到更高的位置。
我把我的Hangfire配置代码放在Startup.Configuration的最底层,当我把仪表板移动到我正在配置的其他一些东西之前时,我碰巧发现仪表板又能工作了。
具体地说,我将它移到了项目中的以下代码之上:
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
// my AutoMapper configuration
// some async/await code that was calling .Wait() here. 我并没有花时间去弄清楚到底是哪一行代码破坏了Hangfire仪表板,但我希望这能对某些人有所帮助。
同样需要说明的是,旧代码在https://localhost:44342/hangfire的IIS Express下工作。我在https://localhost/appname/hangfire上得到了完整的iis404。
发布于 2017-04-11 15:28:12
在web.config文件中添加以下行:
<system.webServer>
<handlers>
<add name="hangfireDashboard" path="hangfire" type="System.Web.DefaultHttpHandler" verb="*" />
</handlers>
</system.webServer>https://stackoverflow.com/questions/34510440
复制相似问题