App Hard Crash (Owin stack overflow) when visiting Dashboard in Production, but not Dev

In my two release builds (Stage & Production), the app will hard crash to an azure 502 error whenever I try and hit the hangfire dashbaord. The same code built in debug works (dev) has no issue hitting the dashboard. Locally I have tried a few things to reproduce the issue via release builds and have been unable to reproduce.

The stack overflow log looks something like:

FaultingExceptionFrame
HelperMethodFrame
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware1+<Invoke>d__5[[System.__Canon, mscorlib]].MoveNext() System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run() System.Threading.Tasks.AwaitTaskContinuation.RunCallback(System.Threading.ContextCallback, System.Object, System.Threading.Tasks.Task ByRef) System.Threading.Tasks.Task.FinishContinuations() System.Threading.Tasks.Task.Finish(Boolean) System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib]].TrySetException(System.Object)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, mscorlib]].SetException(System.Exception) Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware1+d__5[[System.__Canon, mscorlib]].MoveNext()
HelperMethodFrame
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware1+<Invoke>d__5[[System.__Canon, mscorlib]].MoveNext() System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run() System.Threading.Tasks.AwaitTaskContinuation.RunCallback(System.Threading.ContextCallback, System.Object, System.Threading.Tasks.Task ByRef) System.Threading.Tasks.Task.FinishContinuations() System.Threading.Tasks.Task.Finish(Boolean) System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib]].TrySetException(System.Object)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, mscorlib]].SetException(System.Exception) Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware1+d__5[[System.__Canon, mscorlib]].MoveNext()
HelperMethodFrame

Does it look similar to OWIN Stack overflow exception · Issue #424 · aspnet/AspNetKatana · GitHub ? I would appreciate it if you could share the first lines of the exception to understand the originating method for this. Also, could you share your configuration code here?

it is similar to that issue. The error above is pasted directly from the azure logs, so I don’t have much more I can give

  GlobalConfiguration.Configuration
      .UseSqlServerStorage("IdentityConnection",
       new Hangfire.SqlServer.SqlServerStorageOptions()
       {
           //SchemaName = "grady"
       });

  app.UseHangfireDashboard("/hangfire",
      new DashboardOptions
      {
          Authorization = new[] { new Hangfire.Dashboard.AuthorizationFilter() { Roles = "NationalAdministrators" } }                    
      });

  if (h.GetIsHangfireEnabled())
  {
      app.UseHangfireServer();

      TaskManager.Bootstrap();
  }                

The site itself is a multi domained + identiyserver3 setup.