© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•12mo ago•
11 replies
Kler

Get associated RateLimiter for the current HttpContext instance

Hello! I'm currently using and
Microsoft.AspNetCore.RateLimiting
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>(); 
}
app.Use((httpContext, next) =>
{
    // Apparently, it is not possible to do this through dependency injection.
    var rateLimiter = httpContext.RequestServices.GetService<RateLimiter>(); 
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

HttpContext.Current doesn't exist
C#CC# / help
4y ago
✅ Get type of current instance in a static method
C#CC# / help
2y ago
HttpContext and TraceIdentifier
C#CC# / help
2y ago
❔ EF | Get N level associated data
C#CC# / help
3y ago