HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.43k stars 1.71k forks source link

why #2397

Open xcd1111232 opened 7 months ago

xcd1111232 commented 7 months ago

System.InvalidOperationException:“Current JobStorage instance has not been initialized yet. You must set it before using Hangfire Client or Server API. For .NET Core applications please call the IServiceCollection.AddHangfire extension method from Hangfire.NetCore or Hangfire.AspNetCore package depending on your application type when configuring the services and ensure service-based APIs are used instead of static ones, like IBackgroundJobClient instead of BackgroundJob and IRecurringJobManager instead of RecurringJob.”

Angineer48 commented 2 weeks ago

Honestly, not an ideal issue title or description. I'm not surprised that you haven't gotten any responses so far. From (lack of) context, I'm guessing that you are not calling the UseHangfireDashboard method and are using BackgroundJob or RecurringJob which would lead to this exception because those static classes rely on specific global initialization to happen before they can be used. But really, without any more information about the context in which you're getting this exception, the pretty detailed exception message is as good as it is going to get in terms of answering the "why".