Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseHangfireServer throws exception

I have a problem with my ASP.NET Boilerplate Core 2.0 application.

I worked a lot on my application layer and now I want to try the code in the MVC project. But when I try to start the application I get the following error:

System.InvalidOperationException: 'Unable to find the required services. Please add all the required services by calling 'IServiceCollection.AddHangfire' inside the call to 'ConfigureServices(...)' in the application startup code.'

This error occures in line (102): app.UseHangfireServer();

I don't know what is wrong with hangfire. I didn't change code in the startup.cs file.

like image 536
mg92 Avatar asked Feb 12 '26 08:02

mg92


1 Answers

This is what the error message is telling you to do:

services.AddHangfire(config =>
{
    config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
});

Add the above on the line before:

services.AddScoped<IWebResourceManager, WebResourceManager>();
like image 102
aaron Avatar answered Feb 15 '26 12:02

aaron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!