Single Dashboard, Single Physical Server, Multiple Jobs/Projects/Codebases. Advice or Examples?

Reading this thread was very helpful in finding out how to setup a good Hangfire solution. I love the idea of setting it up so each server has a specific queue and the library references to run exactly those jobs. It just makes it all neat and nicely scale-able.

HOWEVER!!!
There is huge issue in Hangfire (v1.7.11) that I was unlucky enough to encounter when using this approach. If you are using recurring jobs, scheduled jobs or re-enqueue jobs with this solution you will run into weird FileNotFoundException: Could not load file or assembly errors.

The issue is #595 on the GitHub project, and there are a number of duplicates or related issues so it can be hard to get exact information or a simple solution.

Simply put, Hangfire (v1.7.11) has a big flaw in its way of handling recurring/scheduled jobs, as it doesn’t check if a server is set to manage the specific queue before assigning the job to it. This means that there is a chance your perfectly separated jobs get handled by the wrong server and promptly fail as it doesn’t have the needed library references.

Workaround would be to have all your Hangfire servers have a reference to all your libraries. This sadly ruins most of what was nice about this whole solution.

1 Like