【新增】新增并发限制中间件【Microsoft.AspNetCore.ConcurrencyLimiter】,限制并发处理,请结合限流进行合理配置。

This commit is contained in:
大灰灰
2022-11-11 02:58:16 +08:00
parent 2313bf6ac9
commit 67496fddfc
7 changed files with 45 additions and 12 deletions

View File

@@ -24,7 +24,6 @@ namespace CoreCms.Net.Configuration
public static readonly string AppConfigAppInterFaceUrl = AppSettingsHelper.GetContent("AppConfig", "AppInterFaceUrl");
#endregion
#region ================================================================================
/// <summary>
/// 获取数据库连接字符串
@@ -36,7 +35,6 @@ namespace CoreCms.Net.Configuration
public static readonly string DbDbType = AppSettingsHelper.GetContent("ConnectionStrings", "DbType");
#endregion
#region redis================================================================================
/// <summary>
@@ -55,7 +53,6 @@ namespace CoreCms.Net.Configuration
#endregion
#region AOP================================================================================
/// <summary>
/// 事务切面开关
@@ -71,14 +68,12 @@ namespace CoreCms.Net.Configuration
public static readonly string JwtConfigAudience = AppSettingsHelper.GetContent("JwtConfig", "Audience");
#endregion
#region Cors跨域设置================================================================================
public static readonly string CorsPolicyName = AppSettingsHelper.GetContent("Cors", "PolicyName");
public static readonly bool CorsEnableAllIPs = AppSettingsHelper.GetContent("Cors", "EnableAllIPs").ObjToBool();
public static readonly string CorsIPs = AppSettingsHelper.GetContent("Cors", "IPs");
#endregion
#region Middleware中间件================================================================================
/// <summary>
/// 是否记录ip信息
@@ -108,8 +103,14 @@ namespace CoreCms.Net.Configuration
/// 是否开启记录到数据库模式
/// </summary>
public static readonly bool MiddlewareRecordAccessLogsEnabledDbMode = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "EnabledDbMode").ObjToBool();
/// <summary>
/// 并发限制(最大并发请求数)
/// </summary>
public static readonly int MiddlewareConcurrencyLimiterMaxConcurrentRequests = AppSettingsHelper.GetContent("Middleware", "ConcurrencyLimiter", "MaxConcurrentRequests").ObjToInt(100);
/// <summary>
/// 并发限制(最大请求数)
/// </summary>
public static readonly int MiddlewareConcurrencyLimiterRequestQueueLimit = AppSettingsHelper.GetContent("Middleware", "ConcurrencyLimiter", "RequestQueueLimit").ObjToInt(100);
#endregion
#region ================================================================================
@@ -145,7 +146,6 @@ namespace CoreCms.Net.Configuration
#endregion
#region ================================================================================
/// <summary>