配置“Hangfire.Net"在 .NET Core 控制台应用程序中? [英] Configure "Hangfire.Net" in .NET Core console application?
本文介绍了配置“Hangfire.Net"在 .NET Core 控制台应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个控制台应用程序,我需要在其中并行执行一些任务,因此我尝试使用 Hangfire.Net.
I am creating a console application in which I need to perform some tasks in parallel so I am trying to use Hangfire.Net.
谁能建议我如何在 .NET Core 控制台应用程序中配置 Hangfire.Net?
Can anyone please suggest me how to configure Hangfire.Net in .NET Core console application?
推荐答案
Hangfire 在 .Net Core 中的配置是相当 state forward 这会将它存储在数据库中.
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();
}
这篇关于配置“Hangfire.Net"在 .NET Core 控制台应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文