Hangfire.io 仪表板映射到 IIS 虚拟目录

BZi*_*ink 5 asp.net iis owin hangfire

我无法让 Hangfire (1.5.8) 仪表板在 IIS 虚拟目录中工作。在我的开发环境中,一切都运行良好,我的应用程序只是映射到本地主机的根目录。另一方面,我们的测试版服务器使用虚拟目录来分隔应用程序和应用程序池。

这是一个使用 Hangfire 和 OWIN Startup 类的 ASP.Net MVC 站点。它被部署到http://beta-server/app-name/. 当我尝试访问 或http://beta-server/app-name/hangfire时,http//beta-server/hangfire我从 IIS 收到 404。

为了解决此问题,我的 IAuthenticationFilter 仅返回 true。

这是我的 Startup.cs,非常基本:

public class Startup
  {
    public void Configuration(IAppBuilder app)
    {
      // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888

      GlobalConfiguration.Configuration
        .UseSqlServerStorage(new DetectsEnvironment().GetEnvironment());

      app.UseHangfireDashboard("/hangfire", new DashboardOptions
      {
        AuthorizationFilters = new[] {new AuthenticationFilter()}
      });
      app.UseHangfireServer();

    }
  }
Run Code Online (Sandbox Code Playgroud)

有人有部署到虚拟目录的有效实施吗?是否有任何 OWIN 中间件管理/管理工具可以用来深入了解 IIS 中注册的 URL?

BZi*_*ink 2

我最终通过将 HTTPHandler 添加到 web.config 中的部分来修复此问题。

<system.webServer>
<handlers>
<add name="hangfireDashboard" path="hangfire" type="System.Web.DefaultHttpHandler" verb="*" />
</handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)