Rate Limiting in .NET 7.0: Getting Started

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ม.ค. 2025

ความคิดเห็น • 5

  • @dylanjhalltech8313
    @dylanjhalltech8313 ปีที่แล้ว +2

    Great demo for its clarity on the subject and demonstration of a useful testing tool

  • @SayeedRizvi
    @SayeedRizvi 2 ปีที่แล้ว +1

    Good demonstration of the concept, but the code does not work on the release build of ASP.NET 7. Can you please update and paste the program.cs here?

    • @alexthecodewolf
      @alexthecodewolf  2 ปีที่แล้ว

      Thanks for watching, here's an example of some code that should work with the latest syntax:
      app.UseRateLimiter(new RateLimiterOptions() { RejectionStatusCode = 429 }
      .AddConcurrencyLimiter("Concurrency", options =>
      {
      options.PermitLimit = 1;
      })
      .AddFixedWindowLimiter("FixedWindow", options =>
      {
      options.Window = TimeSpan.FromSeconds(5);
      options.PermitLimit = 10;
      }));
      app.MapGet("/rate-limiting", () => {
      return "Rate limited.";
      }).RequireRateLimiting("FixedWindow");

  • @asafgoldman8172
    @asafgoldman8172 2 ปีที่แล้ว

    Hi, how to Rate Limit a real IP coming from Cloudflare where they send the real IP in a Header name CF-Connecting-IP?

  • @mtranchi
    @mtranchi 2 ปีที่แล้ว

    Alex!! Used to watch your vids on pluralsite. Great to see you've got a youtube channel!! Subscribed of course.