IIS7 and ASP.NET how to throttle user requests

Mohamed Nuur picture Mohamed Nuur · Dec 12, 2012 · Viewed 7.1k times · Source

I am using ASP.NET with IIS7 and today a bug in one of my pages caused the server to go down. The script was using ajax to query a resource at a rate of ~1000 requests per second. The requests are authenticated, so I know what user requested what page.

My question is, either via IHttpModule or otherwise, how do I limit at the server-level, the max number of requests per second (or per minute) a client is allowed to make and then introduce a delay so that their requests are throttled?

Answer

bbsimonbb picture bbsimonbb · Jul 20, 2020

If anyone finds their way back here, you can throttle requests per user in IIS 8 and up. The setting is denyRequestByRate. The documentation is here.