A dashboard to manage Hangfire's recurring jobs.
License
—
Deps
15
Install Size
—
Vulns
✓ 0
Published
Aug 28, 2025
$ dotnet add package Be.Auto.Hangfire.Dashboard.RecurringJobManagerBe.Auto.Hangfire.Dashboard.RecurringJobManager is a specialized library for managing recurring jobs in Hangfire-based projects. It allows you to configure and manage various types of jobs, including method calls and web requests, directly from the Hangfire Dashboard. This enables all job management tasks to be handled through the dashboard interface without needing to manually add jobs in code.
HangfireWebRequestJobApiClient to simplify adding WebRequestJobs programmatically.Install-Package Be.Auto.Hangfire.Dashboard.RecurringJobManager
Startup.cs, add the following configuration:public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(config => config
.UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection"))
.UseDashboardRecurringJobManager(option =>
{
option.AddAppDomain(AppDomain.CurrentDomain);
option.DisableConcurrentlyJobExecution();
option.WebRequestJobTimeout(TimeSpan.FromSeconds(15));
}));
services.AddHangfireServer();
}
Run the Example Project: Start the project and navigate to http://localhost:<port>/hangfire to access the Hangfire Dashboard.
Add a New Job: Go to the Recurring Job Manager section in the dashboard. Add a new job, selecting either the MethodCall or WebRequestJob type. Enter the necessary parameters, such as HTTP headers, body, and query parameters, directly through the dashboard interface.
Manage Jobs: View, edit, delete, pause, or restart the jobs from the dashboard as needed.
Fire-and-Forget Jobs via API: WebRequestJobs can now be added externally as fire-and-forget jobs via the provided API endpoint /api/web-request-job.
Automatic Resolution: Methods and types within the project are automatically detected, allowing you to configure their parameters directly via the Hangfire Dashboard.
To simplify adding web request jobs programmatically, use the HangfireWebRequestJobApiClient:
// Instantiate client
var client = new HangfireWebRequestJobApiClient(new Uri("https://your-api-host.com"));
client.Headers.Add(new HttpHeaderParameter { Name = "Authorization", Value = "Bearer <token>" });
var jobJson = new WebRequestJobBodyJson
{
Uri = new Uri("https://api.example.com/v1/customers"),
Method = HttpMethodType.POST,
HeaderParameters = new []
{
new HttpHeaderParameter { Name = "Content-Type", Value = "application/json" }
},
BodyParameters = new { name = "Jane Doe", email = "jane@example.com" }
};
var response = await client.AddAsync(jobJson);
Console.WriteLine(response.StatusCode);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<Customer><Name>Jane</Name><Email>jane@example.com</Email></Customer>");
var jobXml = new WebRequestJobBodyXml
{
Uri = new Uri("https://api.example.com/v1/customers"),
Method = HttpMethodType.POST,
HeaderParameters = new []
{
new HttpHeaderParameter { Name = "Content-Type", Value = "application/xml" }
},
BodyParameters = xmlDoc
};
var response = await client.AddAsync(jobXml);
var jobFormUrl = new WebRequestJobBodyFormUrlEncoded
{
Uri = new Uri("https://api.example.com/v1/login"),
Method = HttpMethodType.POST,
HeaderParameters = new []
{
new HttpHeaderParameter { Name = "Content-Type", Value = "application/x-www-form-urlencoded" }
},
BodyParameters = new[]
{
new HttpFormUrlEncodedParameter { Name = "username", Value = "jane" },
new HttpFormUrlEncodedParameter { Name = "password", Value = "123456" }
}
};
var response = await client.AddAsync(jobFormUrl);
var jobFormData = new WebRequestJobBodyFormData
{
Uri = new Uri("https://api.example.com/v1/upload"),
Method = HttpMethodType.POST,
HeaderParameters = new []
{
new HttpHeaderParameter { Name = "Authorization", Value = "Bearer <token>" }
},
BodyParameters = new[]
{
new HttpFormDataParameter { Name = "username", Value = "burak.eser", ContentType = "text/plain" },
new HttpFormDataParameter { Name = "profilePicture", Value = "BASE64_STRING_HERE", ContentType = "image/png" }
}
};
var response = await client.AddAsync(jobFormData);
var jobText = new WebRequestJobBodyPlainText
{
Uri = new Uri("https://api.example.com/v1/notes"),
Method = HttpMethodType.POST,
HeaderParameters = new []
{
new HttpHeaderParameter { Name = "Content-Type", Value = "text/plain" }
},
BodyParameters = "This is a plain text note."
};
var response = await client.AddAsync(jobText);
var jobNone = new WebRequestJobBodyNone
{
Uri = new Uri("https://api.example.com/v1/ping"),
Method = HttpMethodType.GET,
HeaderParameters = new []
{
new HttpHeaderParameter { Name = "Authorization", Value = "Bearer <token>" }
}
};
var response = await client.AddAsync(jobNone);
All responses are returned as
WebRequestJobResponse, containingStatusCode,ExceptionCode, andExceptionMessage.
To contribute, fork this repository, make your changes, and submit a pull request. For any issues or feedback, please open an issue on GitHub.
This project is licensed under the MIT License. See the LICENSE file for more details.