کتابخانه WebApiThrottle
نویسنده: وحید محمدطاهری
تاریخ: ۱۳۹۶/۰۶/۱۸ ۱۴:۱۷
آدرس: www.dntips.ir
ASP.NET Web API Throttling handler, OWIN middleware and filter are designed to control the rate of requests that clients can make to a Web API based on IP address, client API key and request route.
public static void Register( HttpConfiguration config )
{
config.MessageHandlers.Add( new ThrottlingHandler
{
Policy = new ThrottlePolicy( perSecond: 1,
perMinute: 20,
perHour: 200,
perDay: 1500,
perWeek: 3000 )
{
IpThrottling = true
},
Repository = new CacheRepository()
} );
}