限制 Azure 应用服务中的并发请求

Ber*_*ken 2 azure asp.net-web-api azure-web-app-service

鉴于以下

  • ASP.NET Web API 应用程序
  • 目标:.NET Framework 4.6.1
  • 作为 Azure 应用服务托管

我希望限制对应用程序的并发 HTTP 请求总数。

我看过https://github.com/stefanprodan/WebApiThrottle但这似乎集中在不同的用例上。

我想在 IIS 中等效于此设置:https : //forums.asp.net/t/1683143.aspx?Max+concurrent+requests

Amo*_*mor 6

这是为了避免以适得其反的方式攻击后端服务。

为避免攻击,您可以使用动态 IP 限制来限制并发请求。如果并发请求数大于设置值,IP 地址将被阻塞。

<system.webServer>
  <security>
    <dynamicIpSecurity>
      <denyByConcurrentRequests enabled="true" maxConcurrentRequests="30"/>
      <denyByRequestRate enabled="true" maxRequests="30" requestIntervalInMilliseconds="2000"/>
    </dynamicIpSecurity>
  </security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

欲了解更多信息,以下链接供您参考。

在 Windows Azure 网站中配置动态 IP 地址限制