Hangfire official support for MSSQL and Redis two kinds of, of course, can also use third-party to support Mysql,postgresql,mongo, etc.
Installing Redis
sudo apt-get install Software-properties-common
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install Redis-server
PS aux | grep Redis
sudo service redis-server restart
sudo apt-get remove Redis-server
Redis-cli
Redis Desktop Manager installed under MAC (official Mac version only supports source recompilation)
#install Brew Cask
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null
# Install Redis Desktop Manager
brew cask install rdm
ASP. NET Core Integrated Hangfire
Hangfire.pro is an extension of hangfire, using its own Nuget source, Hangfire.Pro.Redis is one of the extensions; I'm here to use the Hangfire.Redis.StackExchange to basically meet the needs.
Add package<packagereference include= "Hangfire.aspnetcore" version= "1.6.12"/><packagereference Include= " Hangfire.Redis.StackExchange.StrongName "version=" 1.7.0 "/><packagereference include=" StackExchange.Redis.StrongName "version=" 1.2.3 "/> Configuration Hangfire Service
Public classStartup { PublicIconfigurationroot Configuration {Get; } Public StaticConnectionmultiplexer Redis; PublicStartup (ihostingenvironment env) {varBuilder =NewConfigurationbuilder (). Setbasepath (env. Contentrootpath). Addjsonfile ("Appsettings.json", Optional:false, Reloadonchange:true) . Addjsonfile ($"appsettings. {env. Environmentname}.json", Optional:true) . Addenvironmentvariables (); Configuration=Builder. Build (); Redis= Connectionmultiplexer.connect (Configuration.getconnectionstring ("Redis")); } //This method gets called by the runtime. Use this method to add services to the container. Public voidconfigureservices (iservicecollection services) {services. AddOptions (); //CustomConfigurationServices. Configure<dbsetting> (Configuration.getsection ("ConnectionStrings")); //return capitalization issuesServices. Addmvc (). Addjsonoptions (OP= = Op. Serializersettings.contractresolver =NewNewtonsoft.Json.Serialization.DefaultContractResolver ()); //Inject Hangfire serviceServices. Addhangfire (config =CONFIG. Useredisstorage (Redis)); } //This method gets called by the runtime. Use this method to configure the HTTP request pipeline. Public voidConfigure (Iapplicationbuilder app, Ihostingenvironment env, iloggerfactory loggerfactory) {Loggerf Actory. Addconsole (Configuration.getsection ("Logging")); Loggerfactory.adddebug (); if(env. Isdevelopment ()) {app. Usedeveloperexceptionpage (); App. Usebrowserlink (); } Else{app. Useexceptionhandler ("/home/error"); } app. Usestaticfiles (); App. Usehangfireserver (); App. Usehangfiredashboard (); App. USEMVC (Routes={routes. MapRoute (Name:"default", Template:"{controller=hq}/{action=index}/{id?}"); }); } }
Https://github.com/marcoCasamento/Hangfire.Redis.StackExchange
Http://docs.hangfire.io/en/latest/configuration/using-redis.html
ASP. NET Core