Skip to content

Instantly share code, notes, and snippets.

@thewindev

thewindev/Startup.cs

Created Oct 12, 2020
Embed
What would you like to do?
Configure Hangfire with MySQL
public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(configuration =>
{
configuration.UseLogProvider(new NoLogProvider());
configuration.UseStorage(new MySqlStorage(_readWriteConnectionString, new MySqlStorageOptions
{
InvisibilityTimeout = TimeSpan.FromMinutes(10)
}));
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
{
app.UseHangfireServer();
//if you need a dashboard for your jobs, just add this in your Configure method
/*app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[] { new HangFireAuthorizationFilter() }
});*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.