語言

RateLimiterOptionsExtensions.AddFixedWindowLimiter 方法

定義

註冊新資料 FixedWindowRateLimiter 給 FixedWindowRateLimiterOptions 應用程式。 限制器可透過 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這個限制器會控制它補充。

適用於