RateLimiterOptionsExtensions.AddFixedWindowLimiter 方法

定義

向應用程式指定的 FixedWindowRateLimiterOptions 註冊新的 FixedWindowRateLimiter 。 限制子可以透過 RequireRateLimiting<TBuilder>(TBuilder, String) 或 透過 EnableRateLimitingAttribute 新增至端點。

public static Microsoft.AspNetCore.RateLimiting.RateLimiterOptions AddFixedWindowLimiter (this Microsoft.AspNetCore.RateLimiting.RateLimiterOptions options, string policyName, Action<System.Threading.RateLimiting.FixedWindowRateLimiterOptions> configureOptions);
static member AddFixedWindowLimiter : Microsoft.AspNetCore.RateLimiting.RateLimiterOptions * string * Action<System.Threading.RateLimiting.FixedWindowRateLimiterOptions> -> Microsoft.AspNetCore.RateLimiting.RateLimiterOptions
<Extension()>
Public Function AddFixedWindowLimiter (options As RateLimiterOptions, policyName As String, configureOptions As Action(Of FixedWindowRateLimiterOptions)) As RateLimiterOptions

參數

options
RateLimiterOptions

RateLimiterOptions要加入限制子的 。

policyName
String

將與限制子相關聯的名稱。

configureOptions
Action<FixedWindowRateLimiterOptions>

FixedWindowRateLimiterOptions 用於限制子之 的回呼。

傳回

這個 RateLimiterOptions

備註

在此設定 AutoReplenishment 不會有任何作用,因為 PartitionedRateLimiter 新增此限制子會控制其補充。

適用於