Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Download collected data problem #6753


User avatar
0
BobIngham created

I am getting an error when selecting the "Download collected data problem" option on the user drop down:

System.InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.

I have Hangfire enabled, Web.Host.StartUp:

            if (WebConsts.HangfireDashboardEnabled)
            {
                //Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
                app.UseHangfireDashboard(WebConsts.HangfireDashboardEndPoint, new DashboardOptions
                {
                    Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
                });
                app.UseHangfireServer();
            }

and Web.Core projectnameWebCoreModule:

            //Uncomment this line to use Hangfire instead of default background job manager (remember also to uncomment related lines in Startup.cs file(s)).
            Configuration.BackgroundJobs.UseHangfire();

The code firing the error is in the ProfileAppService:

        public async Task PrepareCollectedData()
        {

            await _backgroundJobManager.EnqueueAsync<UserCollectedDataPrepareJob, UserIdentifier>(AbpSession.ToUserIdentifier());
        }

I thought by implementing Hangfire the injection of backgroundJobManager would replace abp background manager with Hangfire?


2 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, there is another part of Hangfire configuration in Web.Host.Startup.

    Do you have Hangfire database connection configured?

    See https://github.com/aspnetzero/aspnet-zero-core/blob/9b2476de10667455de1d4f416f552797f6954a3d/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Host/Startup/Startup.cs#L117-L124

  • User Avatar
    0
    BobIngham created

    Hi @ryancq, yes that option is set. However I will take a closer look at this because I have not enabled Hangfire using abp.hangfire, I simply implemented Hangfire in the Core project using Nuget.