Hello all, Actually We're having same issue still with below question after upgrading to Volo.Abp.BackgroundWorkers.Hangfire" Version="5.2.0-rc.2" , but I can't reply because the question was locked.
https://support.abp.io/QA/Questions/2578/AbpBackgroundWorkersHangfireModule-exception-without-using-hangfire-configuration
I'm sharing the exception below , too. Thank you.
- ABP Framework version: v5.2.0-rc.2
- UI type: MVC
- DB provider: EF Core
- **Tiered (MVC) **: yes
- Exception message and stack trace: An error occurred during the initialize Volo.Abp.Modularity.OnPreApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.BackgroundWorkers.Hangfire.AbpBackgroundWorkersHangfireModule, Volo.Abp.BackgroundWorkers.Hangfire, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating λ:Volo.Abp.Hangfire.AbpHangfireBackgroundJobServer -> λ:Hangfire.JobStorage.. See the inner exception for details. ---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.Hangfire.AbpHangfireBackgroundJobServer -> λ:Hangfire.JobStorage. ---> System.InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API. at Hangfire.JobStorage.get_Current()
- Steps to reproduce the issue:"
8 Answer(s)
-
0
Hi,
Did you configure Hangfire?
When you disabled the Background Job & Workers system, ABP will create an only enqueue hangfire server.
It does not execute workers or jobs, like this: https://docs.hangfire.io/en/latest/background-processing/placing-processing-into-another-process.html
-
0
Hello , I've tried from scratch with brand new abp project and I'm getting still same exception. I specially wanted to try in a template project, because there is nothing special , I've implemented configuration and I'm still getting JobStorage error which I shouldn't take. I think there is a problem about Abp Hangfire BackgroundWorker module or it could be related with Abp Background Job Module. Because I think there are some pre initialized background jobs and handlers' running behind by abp and this async jobs can't work with abp hangfire worker ?
I'm sharing my steps : 1- Firstly I created a new tiered application template project from abp suit with 5.2.0-rc.2 version 2- I installed <PackageReference Include="Volo.Abp.HangFire" Version="5.2.0-rc.2" /> and <PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="5.2.0-rc.2" /> references into IdentityServer project. 3- Then I made below configuration inside IdentityServerModule 4- After I ran IdentityServer solution I got below exception :
2022-03-28 13:13:25.938 +03:00 [FTL] deneme52.IdentityServer terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.IdentityServer.AbpIdentityServerDomainModule, Volo.Abp.IdentityServer.Domain, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.. See the inner exception for details. ---> System.InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API. at Hangfire.JobStorage.get_Current() at Hangfire.RecurringJobManager..ctor() at Hangfire.RecurringJob.<>c.<.cctor>b__20_0() at System.Lazy
1.CreateValue() at System.Lazy
1.get_Value() at Hangfire.RecurringJob.AddOrUpdate(Expression`1 methodCall, String cronExpression, TimeZoneInfo timeZone, String queue) at Volo.Abp.BackgroundWorkers.Hangfire.HangfireBackgroundWorkerManager.AddAsync(IBackgroundWorker worker) at Volo.Abp.IdentityServer.AbpIdentityServerDomainModule.OnApplicationInitializationAsync(ApplicationInitializationContext context) at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.InitializeAsync(ApplicationInitializationContext context, IAbpModule module) at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context) --- End of inner exception stack trace --- at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context) at Volo.Abp.AbpApplicationBase.InitializeModulesAsync() at Volo.Abp.AbpApplicationWithExternalServiceProvider.InitializeAsync(IServiceProvider serviceProvider) at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplicationAsync(IApplicationBuilder app) at deneme52.Program.Main(String[] args) in C:\Users\z0046r5w\Downloads\deneme52\src\deneme52.IdentityServer\Program.cs:line 40Thank you.
-
0
Hi,
Can you try this?
GlobalConfiguration.Configuration // Use custom connection string .UseSqlServerStorage(@"Server=.\sqlexpress; Database=Hangfire; Integrated Security=SSPI;");
-
0
Hello , Thanks, It looks like the JobStorage error is gone. But why do we need a global configuration, I had already given the storage configuration with AbpHangfireOptions ?
-
0
Hi,
Because the storage configuration with AbpHangfireOptions is only used to create hangfire server
-
0
Hello , So , in that case abp's default async periodic workers like (Token CleanUp Background worker) need that global configuration right ?
If we want to create background jobs or workers (recurring things) which should be working with Hangfire server, we need to configure this global configuration ? AbpHangfireOptions is just for Hangfire server itself , but it is not including jobs or workers working with this server ? Thank you. -
0
AbpHangfireOptions is just for Hangfire server itself , but it is not including jobs or workers working with this server ?
No, it works with jobs and workers. but I recommend that you always use global configuration.
-
1