RateLimiterOptions.AddPolicy 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
AddPolicy<TPartitionKey,TPolicy>(String) |
使用指定的 policyName 新增速率限制原則。 |
AddPolicy<TPartitionKey>(String, IRateLimiterPolicy<TPartitionKey>) |
使用指定的 policyName 新增速率限制原則。 |
AddPolicy<TPartitionKey>(String, Func<HttpContext,RateLimitPartition<TPartitionKey>>) |
使用指定的 新增速率限制原則 |
AddPolicy<TPartitionKey,TPolicy>(String)
使用指定的 policyName 新增速率限制原則。
public Microsoft.AspNetCore.RateLimiting.RateLimiterOptions AddPolicy<TPartitionKey,TPolicy> (string policyName) where TPolicy : Microsoft.AspNetCore.RateLimiting.IRateLimiterPolicy<TPartitionKey>;
member this.AddPolicy : string -> Microsoft.AspNetCore.RateLimiting.RateLimiterOptions (requires 'Policy :> Microsoft.AspNetCore.RateLimiting.IRateLimiterPolicy<'PartitionKey>)
Public Function AddPolicy(Of TPartitionKey, TPolicy) (policyName As String) As RateLimiterOptions
類型參數
- TPartitionKey
- TPolicy
參數
- policyName
- String
要與指定 TPolicy 相關聯的名稱。
傳回
適用於
AddPolicy<TPartitionKey>(String, IRateLimiterPolicy<TPartitionKey>)
使用指定的 policyName 新增速率限制原則。
public Microsoft.AspNetCore.RateLimiting.RateLimiterOptions AddPolicy<TPartitionKey> (string policyName, Microsoft.AspNetCore.RateLimiting.IRateLimiterPolicy<TPartitionKey> policy);
member this.AddPolicy : string * Microsoft.AspNetCore.RateLimiting.IRateLimiterPolicy<'PartitionKey> -> Microsoft.AspNetCore.RateLimiting.RateLimiterOptions
Public Function AddPolicy(Of TPartitionKey) (policyName As String, policy As IRateLimiterPolicy(Of TPartitionKey)) As RateLimiterOptions
類型參數
- TPartitionKey
參數
- policyName
- String
要與指定 IRateLimiterPolicy<TPartitionKey> 相關聯的名稱。
傳回
適用於
AddPolicy<TPartitionKey>(String, Func<HttpContext,RateLimitPartition<TPartitionKey>>)
使用指定的 新增速率限制原則 policyName
public Microsoft.AspNetCore.RateLimiting.RateLimiterOptions AddPolicy<TPartitionKey> (string policyName, Func<Microsoft.AspNetCore.Http.HttpContext,System.Threading.RateLimiting.RateLimitPartition<TPartitionKey>> partitioner);
member this.AddPolicy : string * Func<Microsoft.AspNetCore.Http.HttpContext, System.Threading.RateLimiting.RateLimitPartition<'PartitionKey>> -> Microsoft.AspNetCore.RateLimiting.RateLimiterOptions
Public Function AddPolicy(Of TPartitionKey) (policyName As String, partitioner As Func(Of HttpContext, RateLimitPartition(Of TPartitionKey))) As RateLimiterOptions
類型參數
- TPartitionKey
參數
- policyName
- String
要與指定 RateLimiter 相關聯的名稱。
- partitioner
- Func<HttpContext,RateLimitPartition<TPartitionKey>>
每次進行 Acquire 或 WaitAsync 呼叫時呼叫的方法,以判斷要套用至要求的速率限制器。