You can deploy the dashboard to your IIS servers and leave the workers in your "additional" servers that are doing the job. In our environment, we have the Dashboard deployed to 4 load balanced servers to view the jobs and activity while additional servers do the actual work.
I have an older configuration and in order to get the Dashboard going, I added a HangfireDashboard.cs file to the App_Start folder. This is where you would do the configuraiton part defining the storage etc for your Hangfire. You will need to reference Hangfire packages along with storage (mongodb, MySql, MsSQL etc) product to access the hangfire backend database.
This is an example of what we have, checks user table to see if the user has access to view (see all jobs running) or edit access (that allows the user to "start" or "cancel" jobs).
using System;
using System.Linq;
using System.Security.Principal;
using System.Web;
using Hangfire;
using Hangfire.Annotations;
using Hangfire.Dashboard;
using Hangfire.Mongo;
using Microsoft.Owin;
using MongoDB.Driver;
using Owin;
[assembly: OwinStartup(typeof(HangfireNamespace.HangfireDashboard))]
namespace HangfireNamespace
{
public class HangfireDashboard
{
public void Configuration(IAppBuilder app)
{
// Set up Connection to the backend. We use MongoDB.
GlobalConfiguration.Configuration.UseMongoStorage(GetMongoClientSettings(), "hangfire", GetMongoClientOptions());
var hangfireAuthz = new HangFireAuthorizationFilter();
var dashboardOptions = new DashboardOptions
{
DashboardTitle = "Hangfire Dashboard",
AppPath = VirtualPathUtility.ToAbsolute("~"),
Authorization = new[] { hangfireAuthz },
IsReadOnlyFunc = (DashboardContext context) => !hangfireAuthz.IsUserAuthorizedToEditHangfireDashboard(context)
};
app.UseHangfireDashboard("/hangfire", dashboardOptions);
}
public class HangFireAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize([NotNull] DashboardContext context)
{
string user = GetLoggedInUserID();
var adminAuthz = _db.UserAccess.FirstOrDefault(
aa =>
aa.UserName.Equals(user) && aa.SubSystem.Equals("Hangfire") &&
(aa.UserPerms.Equals("View") || aa.UserPerms.Equals("Edit")));
return adminAuthz != null;
}
public bool IsUserAuthorizedToEditHangfireDashboard([NotNull] DashboardContext context)
{
string user = GetLoggedInUserID();
var adminAuthz = _db.UserAccess.FirstOrDefault(
aa =>
aa.UserName.Equals(user) && aa.SubSystem.Equals("Hangfire") &&
aa.UserPerms.Equals("Edit"));
return adminAuthz != null;
}
}
}
}
After this, we simply added a href to hangfire to access the dashboard where we needed. Hope it helps.