Limit concurrent requests in Azure App Service

瘦欲@ 提交于 2019-12-31 04:46:06

问题


Given the following

  • ASP.NET Web API application
  • Target: .NET Framework 4.6.1
  • Hosted as Azure App Service

I wish to restrict the total number of concurrent HTTP requests to the application.

I have looked at https://github.com/stefanprodan/WebApiThrottle but that seems to be focused on different use cases.

I would like the equivalent of this setting in IIS: https://forums.asp.net/t/1683143.aspx?Max+concurrent+requests


回答1:


This is to avoid attacking a backend service in counterproductive ways.

To avoid the attack, you could restrict the concurrent requests using Dynamic IP Restrictions. If the concurrent requests count is larger than the setting value, the IP address will be blocked.

<system.webServer>
  <security>
    <dynamicIpSecurity>
      <denyByConcurrentRequests enabled="true" maxConcurrentRequests="30"/>
      <denyByRequestRate enabled="true" maxRequests="30" requestIntervalInMilliseconds="2000"/>
    </dynamicIpSecurity>
  </security>
</system.webServer>

For more information, link below is for your reference.

Configuring Dynamic IP Address Restrictions in Windows Azure Web Sites



来源:https://stackoverflow.com/questions/45014808/limit-concurrent-requests-in-azure-app-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!