Error HTTP Error 403.14 - Forbidden

hi, I followed your directions in this link: http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html, for “Making ASP.NET application always running”, i put this code in my global asax:

    protected void Application_Start(object sender, EventArgs e)
    {
        HangfireBootstrapper.Instance.Start();
    }

    protected void Application_End(object sender, EventArgs e)
    {
        HangfireBootstrapper.Instance.Stop();
    }

but when start my web app the broeswer show this error:
HTTP Error 403.14 - Forbidden

any help?
br
Massimo

Did you set an Authorization filter? You need to specify an authorization filter for production. Otherwise hangfire dashboard gives you a 403 forbidden status.

hi,
now i working in loaclhost and in sturtup i put this:

app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[] { new HangfireAuthorization() }
});

my class HangfireAuthorization is:

public class HangfireAuthorization : IDashboardAuthorizationFilter
{
public bool Authorize([NotNull] DashboardContext context)
{
if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
{
return true;
}
return false;
}
}

but when i lunch the browser, it show this error:

HTTP Error 403.14 - Forbidden

if I move “HangfireBootstrapper.Instance.Start ();” in startup everything is fine!!

First u need to login authorize. Check your HttpContext.Current.User.Identity.IsAuthenticated
If u get 403 this returns false. Just try to login properly

hi,
HttpContext.Current.User.Identity.IsAuthenticated return true,
but the problem remains!

as I said, if I move the code “Hangfire Bootstrapper.Instance.Start ();” from “global.asax” to “startup.cs” everything works correctly

br
Max

ah i think you are right.
I dunno why app_start doesnt work but i use startup.cs too. and it works :slight_smile:

so in order to start a cron will I still have to open the browser?

br
max