Base solution for your next web application
Open Closed

Hangfire recurring job issue #3258


User avatar
0
framecad created

Hi, I tried to add Hangfire recurring jobs in ASP.NET Zero, but could not get it working. Below is what I did:

  1. Create a BackgroundJobAppService insideAPP.Application project, where background tasks will be performed.

  2. Add the following code inside the PostInitialize method of APPWebModule class inAPP. Web project:

var backgroundAppService = IocManager.IocContainer.Resolve<IBackgroundAppService>(); RecurringJob.AddOrUpdate("SoftwareAlert", () => backgroundAppService.SendSoftwareExpiryAlerts(), Cron.Minutely);

However, when I checked the Hangfire dashboard, it showed the following error message:

Could not load file or assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Can anyone help? Much appreciated.

Thanks


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you try to use DomainService instead of AppService for your background job and manage unitOfWork inside your domain service. There is a similar issue by the way, you can read it as well. #2645

    Thanks.