Search code examples
owinhangfire

Hangfire Error on startup


I had hangfire working well for sometime and then I tried to rollback to a previous version that supported .net 4.5.1 and then I went back to .net 4.6.1 and re-upgraded hangfire to 1.6.14 with Owin 3.1. I've reset all my code/nuget references, etc to 1.6.14 and deleted all of the tables so it would recreate them and I'm still getting this error:

'hangfire.dashboard.dashboardmiddleware' does not have a constructor taking 5 arguments.

I'm using owin 3.1 and this happens when using this code:

    [assembly: OwinStartup(typeof(MyWebApplication.Startup))]
    namespace MyWebApplication
    {
    public class Startup
    {
    public void Configuration(IAppBuilder app)
    {
            app.UseHangfire(config =>
            {
                  config.UseSqlServerStorage(ConfigurationManager.ConnectionStrings["QueueConnection"].ConnectionString);
                  config.UseServer();
            });
    }

any ideas?


Solution

  • Try to use hangfire like this:

    JobStorage.Current = new SqlServerStorage(constr);
    app.UseHangfireDashboard();
    app.UseHangfireServer();