pieceofsummer / Hangfire.Console

Job console extension for Hangfire
MIT License
436 stars 80 forks source link

Console section not showing when setting custom hangfire dashboard path #123

Open Rickedb opened 2 years ago

Rickedb commented 2 years ago

Using .Net 6.

Program.cs:


builder.Services.AddHangfire(c => 
                    c.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                     .UseSimpleAssemblyNameTypeSerializer()
                     .UseRecommendedSerializerSettings()
                     .UsePostgreSqlStorage(connection)
                     .UseConsole()
                    ).AddHangfireServer();
....
app.UseHangfireDashboard("/custom/dashboard");

Job:

public void Run(DateTime date, PerformContext context)
{
   context.SetTextColor(ConsoleTextColor.White);
   context.WriteLine($"Processing for date: {date:yyyy-MM-dd}");
   var bar = context.WriteProgressBar();
   bar.SetValue(100);
}

Work as expected when just using the default app.UseHangfireDashboard()