Dela via


RateLimiterOptionsExtensions.AddSlidingWindowLimiter Method

Definition

Registers a new SlidingWindowRateLimiter with the given SlidingWindowRateLimiterOptions to the application. The limiter can be added to an endpoint via RequireRateLimiting<TBuilder>(TBuilder, String), or via the EnableRateLimitingAttribute.

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

Parameters

options
RateLimiterOptions

The RateLimiterOptions to add a limiter to.

policyName
String

The name that will be associated with the limiter.

configureOptions
Action<SlidingWindowRateLimiterOptions>

A callback to configure the SlidingWindowRateLimiterOptions to be used for the limiter.

Returns

This RateLimiterOptions.

Remarks

Setting AutoReplenishment will have no effect here, as the PartitionedRateLimiter that this limiter is added to will control replenishing it.

Applies to