Dashboard returns 404 for application

If I set up my hangfire as a website I am able to access /hangfire dashboard just fine. However when I use it as an application within a site I get a 404 when trying to access the dashboard.

Note: I am using HangfireBootStrapper from http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html to manually set up hangfire, I am trying to avoid using OWINStartup class. Although even when using OWIN I still receive 404 for the dashboard.

Everything else works fine, it is just the dashboard.

I have just found the solution:
In web.config add the following config section:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>

</system.webServer>

In IIS 7, Add a new Managed Handler with Request path is “hangfire*” and Type is “System.Web.DefaultHttpHandler”.

Good luck!

1 Like

This was using the hangfire bootstrapper class and not OWIN? It doesn’t seem to work for me - I’m using the hangfire as an application within a site so would this belong in the webconfig of the parent site, or in the webconfig of the child hangfire application?

You want to be very careful enabling RAMMFAR. This means that every request to IIS – even for static content like images or CSS files – is run through the entire pipeline. Obviously if the goal is just to get something working, then this can do the trick, but it’s definitely not good to leave enabled.

@AndrewMace: I’m using OWIN.
@DuncanMack: I will tried other solutions.

Finally figured it out! There is no need for RAMMFAR.

For anyone else having the same problem, you can go ahead and use the HangfireBootStrapper class I listed above, but also create an OWINStartup Class that uses the assembly and looks something like this

[assembly: OwinStartup(typeof(yourpath.OWINStartup))]

namespace yourenamespace
{
public class OWINStartup
{
	public void Configuration(IAppBuilder app)
	{
		HangfireBootstrapper.Instance.Start();

		var authorizationFilters = new[]
		{
			new AuthorizationOverride(), 
		};

		app.MapHangfireDashboard("/admin", authorizationFilters);
	}
}

I had all of this figured out, but it still wasn’t working so I did this:
1.) Confirm you have the Microsoft.Owin.Host.SystemWeb.dll in your bin directory of this project.
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.

Step 3 was what was causing me grief. I hope this helps someone.