'C# - Throttle incoming API calls

Looking to restrict an API endpoint that I have to only so many calls per second. It doesn't matter who calls it, it just can't allow above a certain amount of (let's say 100) calls per second. What would be a good way of approaching this? And ideally if I can avoid using a NuGet package that would be great.

[HttpGet("myendpoint")]
public ActionResult<string> myEndpoint()
{
   // do work...
}

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source