Dashboard in a distributed environment

Tags: #<Tag:0x00007f185f5da6c8> #<Tag:0x00007f185f5da5d8> #<Tag:0x00007f185f5da4c0>

Hi,

I’m trying to have the Hangfire BackgroundJobServer (with a recurring job) run in a Windows Service on a servers, and the dashboard running from a Web app on another server, but the dashboard doesn’t display job names (shows exception: Could not load file or assembly…) probably because the Web app has no idea about the jobs implemented in the Windows Service. After some reading, I came across two solutions for such distributed scenarios:

  1. Include the dashboard as an OWIN app in the Windows Service itself (like the sample repo) - I tried it, and the dashboard works, even Basic Authentication works (using Hangfire Dashboard Authorization filter), but I can’t get HTTPS working (so that the the dashboard is accessible as https://localhost:9090 or https://[local-IP]:9090) although IIS has a SSL cert installed.

  2. Use an interface in a separate assembly (but common between Web app and Windows Service) and IoC to glue the job definitions in the interface and their implementation in the Windows Service (based on this comment and this one) - I tried it using Hangfire.SimpleInject IoC lib but I couldn’t figure out how to register the implementation class methods (which will be in a different assembly on a separate server).

I’ll appreciate any help or suggestions with either approach to get the dashboard working.

Hi Nick,

You could always include the implementation assembly in the dashboard application so that the definition is available.

Regarding your issue with getting SSL working for the self-hosted dashboard, please see this article:

Essentially the certificate should be setup within http.sys rather than IIS (Internally IIS sets up certificates for its bindings in http.sys itself.) - There is a GUI tool for this if you’d prefer that rather than doing it through the command line:

You will need to ensure that the service’s user account has permission to access the certificate’s private key - This is setup within the certificate management snap-in. (Right click on the installed certificate and go to manage private key permissions)