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 添加到此限制符的 将控制补给它。

适用于