Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development

This commit is contained in:
cheche
2024-01-30 17:31:16 +08:00
3 changed files with 22 additions and 12 deletions

View File

@@ -19,10 +19,9 @@
<ItemGroup>
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.7" />
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.9.3" />
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.26" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,8 +1,8 @@
using Hangfire;
using Hangfire.Dashboard.BasicAuthorization;
using Hangfire.MySql;
using Hangfire.Redis.StackExchange;
using Kurisu.AspNetCore.Startup;
using StackExchange.Redis;
namespace Dlhis.ScheduledTask.Packs;
@@ -14,16 +14,15 @@ public class HangfirePack : BaseAppPack
public override void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(configuration =>
services.AddHangfire((sp, config) =>
{
var options = new MySqlStorageOptions
{
TablesPrefix = "hangfire"
};
configuration.UseSimpleAssemblyNameTypeSerializer()
config.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseStorage(new MySqlStorage(Configuration.GetConnectionString("HangfireConnection"), options));
.UseRedisStorage(sp.GetService<IConnectionMultiplexer>(), new RedisStorageOptions
{
Db = 5,
Prefix = "hangfire"
});
});

View File

@@ -1,7 +1,10 @@
using System.Net.NetworkInformation;
using Kurisu.AspNetCore.Startup;
using Kurisu.Startup;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Options;
using StackExchange.Redis;
using static StackExchange.Redis.Role;
class Program
{
@@ -21,6 +24,15 @@ public class Startup : DefaultStartup
{
base.ConfigureServices(services);
services.AddSingleton<IConnectionMultiplexer>(sp =>
{
return ConnectionMultiplexer.Connect("192.168.199.30:30115,defaultDatabase:1,password=zxc111");
});
var p = new Ping();
Console.WriteLine(p.Send("192.168.199.124").Status);
//todo
var redis = ConnectionMultiplexer.Connect($"192.168.199.30:30115,defaultDatabase:1,password=zxc111");
services.AddDataProtection()