限制Azure App Service中的并发请求 [英] Limit concurrent requests in Azure App Service

查看:121
本文介绍了限制Azure App Service中的并发请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下内容

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

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

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

我看过 https://github.com/stefanprodan/WebApiThrottle ,但这似乎专注于不同的用例.

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

我希望在IIS中达到此设置的等效要求: https://forums.asp.net/t/1683143.aspx?Max+concurrent+requests

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

推荐答案

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

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

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

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.

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

这篇关于限制Azure App Service中的并发请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆