How to access hangfire dashboard when jobs are setup via console application

I have created a .NET Framework 4.5 application using the Hangfire.Core and Hangfire.SqlServe r nuget packages. The code is pretty straight forward.

class Program
    {
        static void Main(string[] args)
        {
            GlobalConfiguration.Configuration
                .UseSqlServerStorage("Server=localhost;Database=HangfireDb;User Id=username;Password=password");
            BackgroundJob.Enqueue(() => ProcessData("process this"));
            using (var server = new BackgroundJobServer())
            {
                Console.WriteLine("Hangfire Server started. Press any key to exit...");
                Console.ReadKey();
            }
        }

        public static void ProcessData(string data)
        {
            Console.WriteLine(data);
        }
    }

After running this program, I see the table schema is created in the database, and the [Job] table gets populated with an entry for this method. However, I don’t know how to access the hangfire dashboard to view the job itself. I tried http://localhost/hangfire but that reports a 404 error. After some googling, I added the following Startup.cs class in the project.

using Hangfire;
using Microsoft.Owin;
using Owin;
using System.Collections.Generic;

[assembly: OwinStartup(typeof(HangfireSample.Startup))]

namespace HangfireSample
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseHangfireServer();
            app.UseHangfireDashboard("/hangfire");
        }
    }
}

I set up a break-point in the Configuration method but it didn’t get hit and I still cannot access the hangfire dashboard. Any suggestions what I am doing wrong here?

You will have to probably host the dashboard on a webserver.

Can you run the web project you got there in debug?

Not sure what do you mean by running the web project? My question is about console application

You can’t run a webpage (the Hangfire dashboard) in a console.

So you need to make a web project that can host the Hangfire dashboard for you. Visual Studio should be able to debug a web project, so you shouldn’t need a whole webserver just to test it. But of course if you want the Hangfire dashboard to be actually running so you can access it from elsewhere and not have to run a local debug version you will need a webserver to run it on.

Do also note that the Hangfire dashboard will need a reference to any code your Hangfire servers are running, or else it won’t be able to show the enqueued jobs correctly. It will still work without the reference, but you will see some “could not load assembly/file” errors instead of the code that was in the jobs.

Can you please provide some sample application/code on how to set it up? I tried to look at the doc/sample/github pages and had no luck so far.