'System.InvalidOperationException: Recurring job can't be scheduled

I have this api endpoint which run C# hangfire.

RecurringJob.AddOrUpdate<IIngestService>(x => x.Process("ABC"), cronExpression, TimeZoneInfo.Local);
RecurringJob.AddOrUpdate<IIngestService>(x => x.Process("XYZ"), cronExpression, TimeZoneInfo.Local);

Problem is it always run Process("XYZ") only. Then I figure that I have to include recurringjobid if the method name are the same.

RecurringJob.AddOrUpdate<IIngestService>("ABC", x => x.Process("ABC"), cronExpression, TimeZoneInfo.Local);
RecurringJob.AddOrUpdate<IIngestService>("XYZ", x => x.Process("XYZ"), cronExpression, TimeZoneInfo.Local);

When I run the job manually from HangFire web, it works without error. But, when hangfire scheduler starts the job automatically after one minute (My cron job is * * * * *), it breaks.

The error message is:

System.InvalidOperationException: Recurring job can't be scheduled, see inner exception for details. ---> Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details. ---> System.TypeLoadException: Could not load type 'xxx.IIngestService' from assembly 'xxx.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source