Functionality to read Hangfire configurations from key-value pair based configuration.
PM> Install-Package Hangfire.Extensions.Configuration -Version 1.0.0
- GetHangfireDashboardOptions: Gets the Hangfire dashboard options.
- GetHangfireBackgroundJobServerOptions: Gets the Hangfire background job server options.
- Add this NuGet package to your project.
- In your
appsettings.json
add the following section:"Hangfire": { "Dashboard": { "AppPath": "/", "StatsPollingInterval": 2000 }, "Server": { "HeartbeatInterval": "00:00:30", "Queues": [ "default" ], "SchedulePollingInterval": "00:00:15", "ServerCheckInterval": "00:05:00", "ServerName": null, "ServerTimeout": "00:05:00", "ShutdownTimeout": "00:00:15", "WorkerCount": 20 } }
- In your
startup.cs
add the following using statement:using Hangfire.Extensions.Configuration;
- In your
startup.cs
add the following lines in theconfigure
method:app.UseHangfireDashboard("/hangfire", Configuration.GetHangfireDashboardOptions()); app.UseHangfireServer(Configuration.GetHangfireBackgroundJobServerOptions());
- Added support to get Hangfire dashboard options from IConfiguration (GetHangfireDashboardOptions)
- Added support to get Hangfire background job server options from IConfiguration(GetHangfireBackgroundJobServerOptions)