Hangfire with Castle.Windsor IoC concrete class resolution

Tags: #<Tag:0x00007f2819bf0318>


I’m using Hangfire along with Castle.Windsor IoC container and trying to kick a “fire an forget” job with a method of a service class which is registered in the IoC through its interface.

My Class is defined as

public class VehicleCatalogManagementService : AbstractManagementService, IVehicleCatalogManagementService

the fire and forget job is posted as

public void KickImportCatalogo()
BackgroundJob.Enqueue(()=> MockImportCatalogo());

whereas MockImportCatalogo() is a void declared in IVehicleCatalogManagementService and implemented in VehicleCatalogManagementService.

Because of the job is serialized as VehicleCatalogManagementService.MockImportCatalogo() when hangfire kicks the job the type VehicleCatalogManagementService is not resolved by the IoC container
The error I have on hangfire is

No component for supporting the service Tasks.VehiclesCatalog.VehicleCatalogManagementService was found

Please note the IoC container would resolve correctly a signature queued as IVehicleCatalogManagementService.MockImportCatalogo()

It’s my understanding this is a problem on Castle component but does anyone got a similar issue or has any suggestion?

thank you