I’m using Hangfire with MySQL server. When I schedule a job, it often failed because of this error The type NewsBusiness does not contain a method with signature DeleteNewsPhysical(Int32). Even though the method is contained in that class and after a few try the job run successfully. Does anyone know the reason behind the fail try?
BackgroundJob.Schedule(() => this.DeleteNewsPhysical(id), TimeSpan.FromSeconds(5));
public void DeleteNewsPhysical(int newsId)
In my case it throws a TypeLoadExceptions, but only sometimes. Sometimes hangfire works just fine, but other times it fails through all the retries for no reason, or at least none I can find. It get’s especially flaky when I send a lot of calls at the same time (like 50 or more).
Maybe someone else here knows what to do?
This is what my code looks like btw.
Thanks for your reply. I solved the problem which is a stupid mistake I made. My local and dev environment is using the same database and the problem is the job try to run in the dev environment which I did not deploy my code yet.
Oh my… yeah we work on this as a team so we have multiple test services running but using the same database. I just turned all but one service off and bam! It works perfectly.
Thanks so much for the reply, I would never have figured out that was to problem!
Please help me understand this. If we have multiple services and if the code isn’t deployed then where would the hangfire service search the delegate method? only in the deployed and running service right?
If there are multiple services running, then each service would have the instance of hangfire and it should work