Dashboard returns 404

When trying to access the hangfire dashboard on my local IIS at domain/hangfire/ I get a 404 response. This is in a webforms project targeting .Net 4.5.1. My startup and authorisationoverride classes are as follows:

[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;
    }
}

Jobs are running successfully, but I’ve run out of ideas for getting the Dashboard to work.

HI jbauer

I have the same problem I get the HTML but I get 404 for the JS and CSS files.
This is only on one production server and not on my dev server or other production srvers I have.
Is there any specific configuration iis7.5 needs to rn it ?

I found this issue but it didnt work for me.

Did you manage to figure it out.

We’ve been through the steps suggested in every solution that’s been suggested, none of them has worked. Thankfully the dashboard is a luxury rather than a necessity so we can use Hangfire wihout it. Still hoping a solution is found though!

In my case I was getting 404 on JS/CSS and it was because I had an overly aggressive URL Rewrite rule trying to force a trailing slash on URLs not containing an extension. I simply added:
<add input="{REQUEST_URI}" pattern="^/hangfire.*$" negate="true" />
to my rule and it works great now!

2 Likes

Thank you @guitarama, you are star, someone had the same rule in the codebase and took me almost 4 hours to realise that.
Many thanks for your post.