From b25e6dc736fcd337d3315aed38bb0c418db5ef01 Mon Sep 17 00:00:00 2001 From: wenyongda Date: Mon, 17 Mar 2025 16:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7.net=209?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/ZR.Infrastructure.csproj | 2 +- ZR.Admin.Grpc/ZR.Admin.Grpc.csproj | 2 +- ZR.Admin.WebApi/Program.cs | 7 ++++++- ZR.Admin.WebApi/ZR.Admin.WebApi.csproj | 2 +- ZR.CodeGenerator/ZR.CodeGenerator.csproj | 2 +- ZR.Common/ZR.Common.csproj | 2 +- ZR.Model/ZR.Model.csproj | 2 +- ZR.Repository/ZR.Repository.csproj | 2 +- ZR.Service/ZR.Service.csproj | 2 +- ZR.ServiceCore/ZR.ServiceCore.csproj | 2 +- ZR.Tasks/ZR.Tasks.csproj | 2 +- 11 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Infrastructure/ZR.Infrastructure.csproj b/Infrastructure/ZR.Infrastructure.csproj index d2396b3..3c72072 100644 --- a/Infrastructure/ZR.Infrastructure.csproj +++ b/Infrastructure/ZR.Infrastructure.csproj @@ -1,6 +1,6 @@  - net7.0 + net9.0 8632 diff --git a/ZR.Admin.Grpc/ZR.Admin.Grpc.csproj b/ZR.Admin.Grpc/ZR.Admin.Grpc.csproj index 5ef8f5d..5d38906 100644 --- a/ZR.Admin.Grpc/ZR.Admin.Grpc.csproj +++ b/ZR.Admin.Grpc/ZR.Admin.Grpc.csproj @@ -1,7 +1,7 @@ - net7.0 + net9.0 enable enable diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 6ebaf7c..d6fba37 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -3,6 +3,7 @@ using Infrastructure.Converter; using Microsoft.AspNetCore.DataProtection; using NLog.Web; using System.Text.Json; +using Microsoft.AspNetCore.RateLimiting; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Redis; using Microsoft.Extensions.Options; @@ -70,7 +71,11 @@ if (openRedis == "1") builder.Services.AddSingleton(new CSRedisCache(RedisHelper.Instance)); } - +builder.Services.AddRateLimiter(o => o + .AddFixedWindowLimiter(policyName: "fixed", options => + { + // configuration + })); builder.Services.AddMvc(options => { diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 2e10d71..fb8eaec 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -1,6 +1,6 @@  - net7.0 + net9.0 enable enable true diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj index dba0753..b6a86d6 100644 --- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj +++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 diff --git a/ZR.Common/ZR.Common.csproj b/ZR.Common/ZR.Common.csproj index 9a9f2a7..29ae756 100644 --- a/ZR.Common/ZR.Common.csproj +++ b/ZR.Common/ZR.Common.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj index cc0b09d..0955548 100644 --- a/ZR.Model/ZR.Model.csproj +++ b/ZR.Model/ZR.Model.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 true 1701;1702;1591;1570 diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj index aca56ae..3b2bd33 100644 --- a/ZR.Repository/ZR.Repository.csproj +++ b/ZR.Repository/ZR.Repository.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj index bbb3ce1..6257b6a 100644 --- a/ZR.Service/ZR.Service.csproj +++ b/ZR.Service/ZR.Service.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 enable true diff --git a/ZR.ServiceCore/ZR.ServiceCore.csproj b/ZR.ServiceCore/ZR.ServiceCore.csproj index 82db85b..14c0a3f 100644 --- a/ZR.ServiceCore/ZR.ServiceCore.csproj +++ b/ZR.ServiceCore/ZR.ServiceCore.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 enable true 1701;1702;1591;1570 diff --git a/ZR.Tasks/ZR.Tasks.csproj b/ZR.Tasks/ZR.Tasks.csproj index 221d49b..5376ce8 100644 --- a/ZR.Tasks/ZR.Tasks.csproj +++ b/ZR.Tasks/ZR.Tasks.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0