diff --git a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs index f24fc43..dbe2baf 100644 --- a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs +++ b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs @@ -59,7 +59,6 @@ using Volo.Abp.SecurityLog; using Volo.Abp.Auditing; using Volo.Abp.BackgroundWorkers.Hangfire; using Hangfire; -using Hangfire.PostgreSql; using Volo.Abp.BackgroundWorkers; using Shentun.Peis.Schedulers; using System.Threading.Tasks; @@ -74,6 +73,7 @@ using Microsoft.AspNetCore.DataProtection; using Volo.Abp.OpenIddict; using System.Security.Cryptography.X509Certificates; using Shentun.Peis.Controllers; +using Hangfire.Redis; namespace Shentun.Peis; @@ -88,6 +88,7 @@ namespace Shentun.Peis; typeof(AbpAspNetCoreSerilogModule), typeof(AbpSwashbuckleModule), typeof(AbpBackgroundWorkersHangfireModule) + )] public class PeisHttpApiHostModule : AbpModule { @@ -224,7 +225,7 @@ public class PeisHttpApiHostModule : AbpModule option.AllowCustomFlow("phone_verify"); }); - + context.Services.AddTransient(); ////虚拟目录 @@ -498,12 +499,19 @@ public class PeisHttpApiHostModule : AbpModule private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration) { + //context.Services.AddHangfire(config => + //{ + // config.UsePostgreSqlStorage(configuration.GetConnectionString("Default")); + //}); + context.Services.AddHangfire(config => { - config.UsePostgreSqlStorage(configuration.GetConnectionString("Default")); + config.UseRedisStorage(configuration["Hangfire:ConnectionStrings"], new RedisStorageOptions + { + Db = string.IsNullOrWhiteSpace(configuration["Hangfire:Db"]) ? 0 : Convert.ToInt32(configuration["Hangfire:Db"]) + }); }); - } public override async void OnApplicationInitialization(ApplicationInitializationContext context) { diff --git a/src/Shentun.Peis.HttpApi.Host/Shentun.Peis.HttpApi.Host.csproj b/src/Shentun.Peis.HttpApi.Host/Shentun.Peis.HttpApi.Host.csproj index a89da31..761af30 100644 --- a/src/Shentun.Peis.HttpApi.Host/Shentun.Peis.HttpApi.Host.csproj +++ b/src/Shentun.Peis.HttpApi.Host/Shentun.Peis.HttpApi.Host.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Shentun.Peis.HttpApi.Host/appsettings.json b/src/Shentun.Peis.HttpApi.Host/appsettings.json index fd4e679..921e599 100644 --- a/src/Shentun.Peis.HttpApi.Host/appsettings.json +++ b/src/Shentun.Peis.HttpApi.Host/appsettings.json @@ -13,7 +13,7 @@ }, "ConnectionStrings": { //"Default": "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508;User ID=postgres;Password=st123;" - "Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;" + "Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;" //"Default": "Host=192.168.2.67;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;" }, "AuthServer": { @@ -59,8 +59,10 @@ "IsEnabled": true }, "Hangfire": { - "IsEnabled": false, - "IsEnabledDashboard": false + "IsEnabled": true, + "IsEnabledDashboard": true, + "ConnectionStrings": "127.0.0.1:6379,password=wxd123", + "Db": 3 }, "Pacs": { "AuthString": "peis:peis@123",