ContinueJobs hangfire .net 4.8

after success jobEmail
job2 is:
BackgroundJob.ContinueJobWith(jobEmail,() => UpdateProductNotification(item), JobContinuationOptions.OnlyOnSucceededState);

job2 is failed
error :slightly_frowning_face:

Unity.ResolutionFailedException

Resolution failed with error: No public constructor is available for type Nick.DataAccess.Infrastructure.IUnitOfWork. For more detailed information run Unity in debug mode: new UnityContainer(ModeFlags.Diagnostic)

Unity.ResolutionFailedException: Resolution failed with error: No public constructor is available for type Nick.DataAccess.Infrastructure.IUnitOfWork.

config startup for hangfire

Global.cs

This isn’t specific to Hangfire. You need to setup the container before passing it to Hangfire. You also shouldn’t be registering types in the job activator. The passed container should already be setup.

I’m not familiar with Unity but the syntax looks similar to autofac. You should be registering the concrete type as the injectable type. Something like:

container.RegisterType<MyBackgroundService>().As<IBackgroundService>().InstancePerLifetimeScope();

I also don’t see an implementation of IUnitOfWork registered in the container which is where the error is coming from.

Many thanks

1-implementation of IUnitOfWork and IBackgroundService registered and injection in the container
Startup.cs

UnityConfig.cs

action of controller for updateProductNotification is

BackgroundJob.ContinueJobWith(jobEmail,() => UpdateProductNotification(item), JobContinuationOptions.OnlyOnSucceededState);

error

hangfire dashboard

thanks