Hangfire Dashboard - Cannot access overview page

After upgrade to most recent Hangfire one of our tenant is unable to access dashboard overview with error:

InvalidOperationException: Sequence contains more than one element
System.Linq.ThrowHelper.ThrowMoreThanOneElementException()
System.Linq.Enumerable.TryGetSingle<TSource>(IEnumerable<TSource> source, out bool found)
System.Linq.Enumerable.Single<TSource>(IEnumerable<TSource> source)
Hangfire.SqlServer.SqlServerStorage+<>c.<.cctor>b__56_10(DbConnection connection)
Hangfire.SqlServer.SqlServerStorage.UseConnection<T>(DbConnection dedicatedConnection, Func<DbConnection, T> func)
Hangfire.SqlServer.SqlServerStorage+<>c.<.cctor>b__56_3(RazorPage page)
Hangfire.Dashboard.Pages.BlockMetric.Execute() in _BlockMetric.cshtml
+
    var metric = DashboardMetric.Func(this);
Hangfire.Dashboard.RazorPage.TransformText(string body) in RazorPage.cs
+
            Execute();
Hangfire.Dashboard.RazorPage.ToString() in RazorPage.cs
+
            return TransformText(null);
Hangfire.Dashboard.HtmlHelper.RenderPartial(RazorPage partialPage) in HtmlHelper.cs
+
            return new NonEscapedString(partialPage.ToString());
Hangfire.Dashboard.HtmlHelper.BlockMetric(DashboardMetric metric) in HtmlHelper.cs
+
            return RenderPartial(new BlockMetric(metric));
Hangfire.Dashboard.Pages.HomePage.Execute() in HomePage.cshtml
+
                        @Html.BlockMetric(metric)
Hangfire.Dashboard.RazorPage.TransformText(string body) in RazorPage.cs
+
            Execute();
Hangfire.Dashboard.RazorPage.ToString() in RazorPage.cs
+
            return TransformText(null);
Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context) in RazorPageDispatcher.cs
+
            return context.Response.WriteAsync(page.ToString());
Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Configurations of all tenants is the same, only that one is failing. Other views are accessible.

2 Likes

I came here for the exact same problem. We even removed the Hangfire schema, but problem persists

I’ve just discover funny thing. I’ve get hangfire source and attach first only Hangfire.Core project - which reproduce that issue, but when I’ve attached Hangfire.SqlServer project instead of nuget package it magicly works… So could not even get more details for that issue

ok, check version 1.8.2 - I’ve realized I did not checked it since we did upgrade recently :slight_smile:

Hi There -

I belive the schema chnaged between version 1.7 and 1.8. i think this issue arises of the database has not been migrated correctly

1 Like

Thanks for this, bang on. Dropped the tables and schema, restarted the app pool and the tables rebuilt and all was happy. All job history lost but an easy solve and that history was not as important as the tasks running :slight_smile:

Drop schema script

DROP TABLE HangFire.AggregatedCounter
DROP TABLE HangFire.Counter
DROP TABLE HangFire.Hash
DROP TABLE HangFire.JobParameter
DROP TABLE HangFire.JobQueue
DROP TABLE HangFire.List
DROP TABLE HangFire.[Schema]
DROP TABLE HangFire.Server
DROP TABLE HangFire.[Set]
DROP TABLE HangFire.State
DROP TABLE HangFire.Job
DROP SCHEMA HangFire