My server is returning a 404 when I try to go to hangfire/jobs/enqueued. The same page does not 404 when I run locally which has me very confused. At first I thought it might be a routing issue, but modifying the base route for hangfire has had no effect.
I’m currently running version 1.5.6. I have tried removing the hangfire tables, rebuilding, reverting to an older version of hangfire, restarting the app pool, and removing the Temp ASP.net files. Needless to say, nothing has worked. The server still returns a 404 when requesting hangfire/jobs/enqueued.
Additionally, I noticed that I cannot trigger recurring jobs under the recurring jobs page hangfire/recurring
. Again, the ajax request /hangfire/recurring/trigger
returns a 404. I cannot see the jobs nor can I trigger them manually; however the jobs do run and complete successfully when they are scheduled to.
Here is my Startup.cs and Bootstrapper:
Startup.cs
[assembly: OwinStartup(typeof(myApp.Startup))]
namespace myApp
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var options = new DashboardOptions
{
AuthorizationFilters = new IAuthorizationFilter[]
{
new AuthorizationFilter {Users = "admin"},
},
AppPath = VirtualPathUtility.ToAbsolute("~/Admin")
};
app.UseHangfireDashboard("/hangfire", options);
app.UseHangfireServer();
}
}
}
HangfireBootstrapper.cs
namespace myApp
{
public class HangfireBootstrapper : IRegisteredObject
{
public static readonly HangfireBootstrapper Instance = new HangfireBootstrapper();
private readonly object _lockObject = new object();
private bool _started;
private BackgroundJobServer _backgroundJobServer;
public void Start()
{
lock (_lockObject)
{
if (_started) return;
_started = true;
HostingEnvironment.RegisterObject(this);
GlobalConfiguration.Configuration
.UseSqlServerStorage("myApp");
_backgroundJobServer = new BackgroundJobServer();
}
}
public void Stop()
{
lock (_lockObject)
{
if (_backgroundJobServer != null)
{
_backgroundJobServer.Dispose();
}
HostingEnvironment.UnregisterObject(this);
}
}
void IRegisteredObject.Stop(bool immediate)
{
Stop();
}
}
}