配置“ Hangfire.Net”在.NET Core控制台应用程序中? [英] Configure "Hangfire.Net" in .NET Core console application?

查看:597
本文介绍了配置“ 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?

推荐答案

.net Core中的Hangfire配置是非常状态转发的,它将存储在数据库中。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆