My application is single page application built with asp.net core. I recently installed the hangfire in order for putting all the resource intense task in the background so it doesn't clog the server. However i am not able to display dashboard page. Here is the snippets of how I defined the dashboard path in startup. what I am doing wrong here?
app.UseStaticFiles();
app.UseRewritePath();
app.UseAuthentication();
app.UseHangfireDashboard("/hangfire");
app.UseHangfireServer();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
It appears that app.UseRewritePath();
is catching the route before it hits hangfire and sending it to the root of your SPA. The order in which you setup your routes matters.
Reorder your configuration like so:
app.UseStaticFiles();
app.UseHangfireDashboard("/hangfire");
app.UseRewritePath();
app.UseAuthentication();
app.UseHangfireServer();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});