HangFire持久化数据到Redis


教程:ASP.NET Core MVC上的Redis上的Hangfire

入门

要在ASP.NET Core MVC项目中针对Redis使用Hangfire,首先需要安装至少以下两个软件包:Hangfire.AspNetCoreHangfire.Redis.StackExchange

Startup.cs,这些都是最起码,你将需要编写使迟发型对Redis的代码:

public class Startup
{
    

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddHangfire(configuration =>
        {
            configuration.UseRedisStorage("localhost");
        });
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        app.UseHangfireServer();
    }
}

注意:我这里安装了 Hangfire.Redis.StackExchange.StrongName 这个包才能成功

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM