Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hangfire 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, Hangfire is version 1.5.3. 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.

like image 565
Jason Avatar asked Dec 29 '15 11:12

Jason


1 Answers

I had something similar but I managed to get it resolved by reading through this post.

Hope you will have a better luck following through that if you haven't yet. The main problem for me was the missing DLL, and then the removing site data from the TemporaryASP.NET folder.

Edit: Someone down voted this answer because I used a link for the solution.

Since I did find a solution to this specific problem, I thought I will give it another try to share. :)

Here are the steps that I have taken to come to a solution.

  1. Confirm you have the Microsoft.Owin.Host.SystemWeb.dll in your bin directory of this project. (In my case, the dll was missing)
  2. Stop your app pool
  3. Navigate to your TemporaryASP.NET folder : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files and delete the folder inside of your site/application's folder.
  4. Restart you app pool
  5. Navigate to "/admin" or whatever you set your dashboard url to be "/hangfire" by default.
like image 159
Ray T Avatar answered Oct 05 '22 01:10

Ray T