How to configure “Hangfire.Net” in .NET Core conso

2019-09-21 09:14发布

问题:

I am creating a console application in which I need to perform some tasks in parallel so I am trying to use Hangfire.Net.

Can anyone please suggest me how to configure Hangfire.Net in .NET Core console application?

Kind regards,

Jatinder

回答1:

Configuration of Hangfire in .Net Core is quite state forward This will store it in the database.

GlobalConfiguration.Configuration.UseSqlServerStorage("connection_string");

using (var server = new BackgroundJobServer())
    {
     Console.WriteLine("Hangfire Server started. Press any key to exit...");
     Console.ReadKey();
    }

Code ripped from documentation