Recurring jobs are not getting triggered in Production

Tags: #<Tag:0x00007f23582bf048> #<Tag:0x00007f23582abb60> #<Tag:0x00007f23582ab200>

Hi Team , could you please help me with the error in the below screen shot , recurring jobs are not getting triggered everyday only in production, if I connect prod db and triggred the job then it runs successfully , but automatically it trigrred first day of creation and then gives the below error .

“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 ‘Controllers’ from assembly”
at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Hangfire.Common.TypeHelper.TypeResolver(Assembly assembly, String typeName, Boolean ignoreCase)
at System.TypeNameParser.ResolveType(Assembly assembly, String[] names, Func4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark) at System.TypeNameParser.ConstructType(Func2 assemblyResolver, Func4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark) at System.TypeNameParser.GetType(String typeName, Func2 assemblyResolver, Func4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark) at System.Type.GetType(String typeName, Func2 assemblyResolver, Func4 typeResolver, Boolean throwOnError) at Hangfire.Common.TypeHelper.DefaultTypeResolver(String typeName) at Hangfire.Storage.InvocationData.DeserializeJob() --- End of inner exception stack trace --- at Hangfire.Storage.InvocationData.DeserializeJob() at Hangfire.RecurringJobEntity..ctor(String recurringJobId, IDictionary2 recurringJob, ITimeZoneResolver timeZoneResolver, DateTime now)
— End of inner exception stack trace —
at Hangfire.Server.RecurringJobScheduler.ScheduleRecurringJob(BackgroundProcessContext context, IStorageConnection connection, String recurringJobId, RecurringJobEntity recurringJob, DateTime now)

One thing which I observe is there are two servers, is that can be the issue ?

Do all your servers have access to the same codebase?

@Jonah_Simpson Yes access to the codebase.

My other jobs are working from the same servers only recurring job is giving this issue.
How can I check Hangfire server ?
Is the servers in Hangfire.Server are hangfire server ?

@odinserj please guide

What version of Hangfire.Core do you have? In one of the recent versions such recurring job will be rescheduled and there will be a chance that recurring job will be handled by a correct server next time. The thing is that recurring job schedule is shared among all the servers, since the same storage is used. So when recurring job with unknown payload is detected, we can’t handle it properly.

Hi We are using Hangfire Core Version - 1.7.16.
How can we resolve this ?
With the same payload its working in other environments except Prod.
@odinserj

@MitaliChourey is it possible you are using different code bases within the same storage?

Yes we are using deployment slot , but DB is same @odinserj

Are deployment slots considered as a staging environment in your application that’s detached from the main application? If yes, you can simply check the corresponding environment variable (https://stackoverflow.com/a/46087043/1317575) and don’t run the processing server in this case.