You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/performance/rate-limit.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ The following steps show how to use the rate limiting middleware in an ASP.NET C
62
62
63
63
2. Configure rate limiting services.
64
64
65
-
In the `Program.cs` file, configure the rate limiting services by adding the appropriate rate limiting policies. Policies can either be defined as global or named polices. The following example permits 10 requests per minute:
65
+
In the `Program.cs` file, configure the rate limiting services by adding the appropriate rate limiting policies. Policies can either be defined as global or named polices. The following example permits 10 requests per minute by user (identity) or globally:
66
66
67
67
```csharp
68
68
builder.Services.AddRateLimiter(options=>
@@ -80,7 +80,7 @@ The following steps show how to use the rate limiting middleware in an ASP.NET C
80
80
});
81
81
```
82
82
83
-
Named polices need to be explicitly applied to the pages or endpoints. The following example adds a fixed window limiter:
83
+
Named polices need to be explicitly applied to the pages or endpoints. The following example adds a fixed window limiter policy named `"fixed"` which we'll add to an endpoint later:
84
84
85
85
```csharp
86
86
varbuilder=WebApplication.CreateBuilder(args);
@@ -99,7 +99,7 @@ The following steps show how to use the rate limiting middleware in an ASP.NET C
99
99
varapp=builder.Build();
100
100
```
101
101
102
-
The global limiter applies to all endpoints automatically when it's configured via [options.GlobalLimiter](/dotnet/api/microsoft.aspnetcore.ratelimiting.ratelimiteroptions.globallimiter), and no endpoint-specific policy is specified.
102
+
The global limiter applies to all endpoints automatically when it's configured via [options.GlobalLimiter](/dotnet/api/microsoft.aspnetcore.ratelimiting.ratelimiteroptions.globallimiter).
103
103
104
104
3. Enable rate limiting middleware
105
105
@@ -163,10 +163,10 @@ To set a policy for a single routable Razor component or a folder of components
163
163
<h1>Counter</h1>
164
164
```
165
165
166
-
The [`DisableRateLimiting` attribute](xref:Microsoft.AspNetCore.RateLimiting.DisableRateLimitingAttribute) is used to disable rate limiting for a routable component or a folder of components via an `_Imports.razor` file.
167
-
168
166
The [`[EnableRateLimiting]` attribute](xref:Microsoft.AspNetCore.RateLimiting.EnableRateLimitingAttribute) is only applied to a routable component or a folder of components via an `_Imports.razor` file if <xref:Microsoft.AspNetCore.Builder.RateLimiterEndpointConventionBuilderExtensions.RequireRateLimiting%2A> is ***not*** called on <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A>.
169
167
168
+
The [`[DisableRateLimiting]` attribute](xref:Microsoft.AspNetCore.RateLimiting.DisableRateLimitingAttribute) is used to disable rate limiting for a routable component or a folder of components via an `_Imports.razor` file.
169
+
170
170
## Rate limiter algorithms
171
171
172
172
The [`RateLimiterOptionsExtensions`](/dotnet/api/microsoft.aspnetcore.ratelimiting.ratelimiteroptionsextensions) class provides the following extension methods for rate limiting:
0 commit comments