Enable Rate Limit

Enable Rate Limit

Rate Limit middleware is setup in Program.cs file, but it's commented out to not enabled by default because it need to apply to each use-case carefully.

Consult the following Microsoft documentation to understand each option and decide which type of rate limit works for your app:

Here is an example how to enable a rate limit (token policy) for MVC endpoint:

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}")
    .RequireRateLimiting(tokenPolicy); //enable rate limit for MVC
An unhandled error has occurred. Reload 🗙