When trying to schedule reports an error pops up. Looking at the logs this is what I am seeing any ideas?
---> 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.
at Hangfire.JobStorage.get_Current()
at Hangfire.RecurringJobManager..ctor()
at Hangfire.RecurringJob.<>c.<.cctor>b21_0()
at System.Lazy1.CreateValue() at Hangfire.RecurringJob.AddOrUpdate(String recurringJobId, Expression1 methodCall, String cronExpression, TimeZoneInfo timeZone, String queue)
at QueryTree.Controllers.ApiController.AddOrUpdateJob(ScheduledReport schedule, String editUrl, String period) in /build/Web/Controllers/ApiController.cs:line 393
at QueryTree.Controllers.ApiController.AddOrUpdateScheduleJob(ScheduledReport schedule, String editUrl) in /build/Web/Controllers/ApiController.cs:line 370
at QueryTree.Controllers.ApiController.AddOrUpdateScheduleTask(ScheduledReport scheduledReport) in /build/Web/Controllers/ApiController.cs:line 362
at QueryTree.Controllers.ApiController.Schedule(ScheduledReportViewModel model) in /build/Web/Controllers/ApiController.cs:line 350
at lambda_method615(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
When trying to schedule reports an error pops up. Looking at the logs this is what I am seeing any ideas?
---> 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 theg Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
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, likeIBackgroundJobClient
instead ofBackgroundJob
andIRecurringJobManager
instead ofRecurringJob
. at Hangfire.JobStorage.get_Current() at Hangfire.RecurringJobManager..ctor() at Hangfire.RecurringJob.<>c.<.cctor>b21_0() at System.Lazy1.CreateValue() at Hangfire.RecurringJob.AddOrUpdate(String recurringJobId, Expression
1 methodCall, String cronExpression, TimeZoneInfo timeZone, String queue) at QueryTree.Controllers.ApiController.AddOrUpdateJob(ScheduledReport schedule, String editUrl, String period) in /build/Web/Controllers/ApiController.cs:line 393 at QueryTree.Controllers.ApiController.AddOrUpdateScheduleJob(ScheduledReport schedule, String editUrl) in /build/Web/Controllers/ApiController.cs:line 370 at QueryTree.Controllers.ApiController.AddOrUpdateScheduleTask(ScheduledReport scheduledReport) in /build/Web/Controllers/ApiController.cs:line 362 at QueryTree.Controllers.ApiController.Schedule(ScheduledReportViewModel model) in /build/Web/Controllers/ApiController.cs:line 350 at lambda_method615(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.