A rate limiting package for .NET

Two new interesting packages are coming to .Net: System.Threading.RateLimiting and Microsoft.AspNetCore.RateLimiting.

A very good introductory article can be found here: https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/.

Even if this package is announced as a new feature of version 7.0, System.Threading.RateLimiting is a .Net runtime package targeting :

  • .Net Framework 4.6.1,
  • .Net Standard 2.0,
  • .Net 6.0,
  • .Net 7.0

making it a solution for all needs (It’s use is not restricted to http requests handling). The aforementioned article shows how to use it in DelegatingHandler to limit outgoing http requests but it an edge case.

Main use is obviously for processing incoming http requests. For this usage, a .Net 7.0 Microsoft.AspNetCore.RateLimiting package is also provided by Microsoft. It’s mainly a rate limiting middleware hiden behind policies. Policies are named configurations of rate limiters usable in http pipeline branches.

The design of the API seems extensible and clean, it will have to be seen in use. The only regret is that Middleware is only available for .Net 7, a non-LTS release.

Improving Azure Key Vault use as configuration source in ASP.NET Core

Something I’ve missed: loading Key Vault secrets in .Net Core as configuration source can be a lengthy process if you don’t opt-out from unused authentication modes.

Hopefully, authentication chain construction can be customized by setting numerous ExcludeXxxx properties of DefaultAzureCredentialOptions. Some of these property are true by default but only a few.

More details here: Improving Azure Key Vault Performance in ASP.NET Core By Up To 10x (the assertion “Up to 10x” is a bit marketing, actual gain should be tested as it depends on many factors 🙂 ).