Changing target framework from .NET Core 3.1 to .NET 6.0 makes the ASP.NET app crash when services.AddHangfireServer() is called. It’s happening on local development machines only (same result on both Linux & Windows dev boxes), but oddly enough, works on production servers (IIS).
Here is the output when run with IISEXPRESS:
The program ‘[8532] iisexpress.exe: Program Trace’ has exited with code 0 (0x0).
The program ‘[8532] iisexpress.exe’ has exited with code 3221225477 (0xc0000005) ‘Access violation’.
The program ‘’ has exited with code 4294967295 (0xffffffff).
The program ‘’ has exited with code 4294967295 (0xffffffff).
Here is the output when run with kestrel:
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) ‘https://localhost:5001, http://localhost:5000’. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://[::]:5003
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Code\project\someproject.Dashboard
Stack overflow.
Has anyone encountered the problem before and know how to safely upgrade the projects to .NET 6.0 ?
When you upgraded the .net version, did you also reinstall your packages? That would be step one. Beyond that… I did not run into any issues that I can recall, but I also went from 3.1 to 5 and then to 6, so perhaps I’ve forgotten any issues I ran into in the first upgrade.
Curious as to whether you figured this out? Trying to think of what could cause a StackOverflowException within Hangfire.
Does it happen only when enabling the dashboard (so, crashes on startup)? Or when trying to access the dashboard?
There would also be schema updates that Hangfire wants to run, on startup - I’d assume your local machines are running under different users than the production server(s), so it’s possible that the app is crashing when attempting to run the migrations?
Just so I follow, you’re saying that if you comment out the above lines (which means the dashboard isn’t enabled) allows the application to start up normally?
Does it work if you remove the authorization filter?