C#C
C#11mo ago
Michi

Get associated RateLimiter for the current HttpContext instance

Hello! I'm currently using and Microsoft.AspNetCore.RateLimiting and my question is if is there any way to get the associated RateLimiter instance for the current HttpContext.
app.Use((httpContext, next) =>
{
    // Apparently, it is not possible to do this through dependency injection.
    var rateLimiter = httpContext.RequestServices.GetService<RateLimiter>(); 
}
Was this page helpful?