ASP.NET Core 5 application: HTTP 500.30 in production

Hello community,

I have just configured Hangfire to have some scheduled tasks done, it works fine in development mode but when I publish my app to IIS the application cannot start and provides a 500.30

After I commented out all of the Hangfire code in Startup.cs and re-deploy, the application starts and functions normally

Has anyone else encountered this issue and/or has any tips on how to resolve this?

I found out that the app crashes when the foreach is out-commented:

                using (var connection = JobStorage.Current.GetConnection())
                {
            //        foreach (var recurringJob in connection.GetRecurringJobs())
             //       {
           //             RecurringJob.RemoveIfExists(recurringJob.Id);
            //        }
                }

When I Query the database, it says all Hangfire tables are empty

Warm regards

I think you should save the results from GetReccurringJobs in a variable and then loop trough it, otherwise you have a problem on the iteration. see: Code Inspection: Possible multiple enumeration of IEnumerable | ReSharper