How can I use dashboard in Self-Hosted OWIN Console Application ? Is there any sample available ?
Hi Yogi, how are you?
Let me see, you need install this packages:
Install-package Hangfire.Core
Install-package Hangfire.SqlServer
Install-package Microsoft.Owin.Hosting
Install-package Microsoft.Owin.Host.HttpListener
Your startup:
public class Startup {
public void Configuration(IAppBuilder app){
GlobalConfiguration.Configuration.UseSqlServerStorage("tdc");
app.UseHangfireDashboard();
app.UseHangfireServer();
}
}
Your Main:
static void Main(string[] args) {
using (WebApp.Start<Startup>("URL:PORT")){
RecurringJob.AddOrUpdate(() => Console.WriteLine("Hangfire Works"), Cron.Minutely);
Console.WriteLine("Hangfire on");
Console.ReadKey();
}
}
So, with this, when you project are running, hf dashboard will run on URL:PORT
This should help you!
I highly appriciate your support, thank you very much , It works like charm.
I’m happy to help.
Thanks so much :). You save for me a lot of time.
How can I do this but using .net core framework?
Anyone make this work with .NET 6 and/or 7? I am unable to add any HF related “Use…” statements within my Startup.