RateLimiterOptions.AddPolicy 方法

定义

重载

AddPolicy<TPartitionKey,TPolicy>(String)

使用给定 policyName 添加新的速率限制策略。

AddPolicy<TPartitionKey>(String, IRateLimiterPolicy<TPartitionKey>)

使用给定 policyName 添加新的速率限制策略。

AddPolicy<TPartitionKey>(String, Func<HttpContext,RateLimitPartition<TPartitionKey>>)

使用给定的 添加新的速率限制策略 policyName

AddPolicy<TPartitionKey,TPolicy>(String)

Source:
RateLimiterOptions.cs

使用给定 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>)

Source:
RateLimiterOptions.cs

使用给定 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>>)

Source:
RateLimiterOptions.cs

使用给定的 添加新的速率限制策略 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 时调用的方法,以确定要应用于请求的速率限制器。

返回

适用于