I am working on a Dotnet 7 console application which is for data conversion tasks. I added hangfire to start and manage the tasks.
Now we want to have the dashboard inlcuded.
I added Owin and a new Class with Configuration. However i can add any packages and there is no IAppBuilder extension to configure the dashboard?
I added Hangfrie.aspnetcore or hangfire.core. None of them is having this extension?
Does anybody know how to get the dashboard working in a console app with OWIN?
It’s easiest to just create an ASP.NET Core Web API project. Rip out all the controller and swagger code. Create a Worker service and then you can add the dashboard.
Do all the console app work on the Worker service
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddHangfire(config =>
{
config.UseInMemoryStorage();
});
builder.Services.AddHostedService<Worker>();
builder.Services.AddHangfireServer();
var app = builder.Build();
app.UseHangfireDashboard();
app.Run();
}
}
}