Hello,
I have 4 ASP.NET MVC 5 applications on a server where I want to use Hangfire.
Do I need to have the Hangfire tables in each application SQL database?
Or can I have a Hangfire database and all application use that one?
Thank You,
Miguel
Hello,
I have 4 ASP.NET MVC 5 applications on a server where I want to use Hangfire.
Do I need to have the Hangfire tables in each application SQL database?
Or can I have a Hangfire database and all application use that one?
Thank You,
Miguel
My recommendation: use separate databases for different code bases. Otherwise workers of one application may encounter background job that is intended for other application, and this will result to a failed job.
Hangfire itself is responsible for maintain its tables. It automatically deletes old jobs, purges outdated statistics and maintains its schema. So this recommendation will not result in additional maintenance problems.
Even if you use separate databases (which I agree you should) you still need to be careful with the configuration of these multiple applications, or else you might run into this problem: https://github.com/HangfireIO/Hangfire/issues/223
I have the same issue and I have posted a possible solution here:
Also, the ServerName limit in version 1.43 is 50, but the last five chars. is added by Hangfire as an application id eg. “:9018” so you can only assign 45 characters. It fails silently so take extra care here ; )