我正在尝试使用IIS动态IP限制来限制来自同一IP的请求。我已经启用了模块,如果我从IIS UI编辑动态限制设置,则请求会被很好地限制。这很好,但是我需要在不同的URL上有不同的速率。例如,登录应该比静态资源更严格。我正在尝试使用web.config中的locations
来实现这一点。
<configuration>
<location path="foo">
<system.webServer>
<security>
<dynamicIpSecurity enableLoggingOnlyMode="true">
<denyByRequestRate enabled="true" maxRequests="1"
requestIntervalInMilliseconds="5000" />
</dynamicIpSecurity>
</security>
</system.webServer>
</location>
</configuration>
不幸的是,这并不适用。我相当确定这与我的应用程序无关,因为它在一个只有一个HTML文件的静态网站上也无法工作。我也很确定位置路径是正确的,因为如果我添加...<deny users="*" />
,请求将被阻止。
enableLoggingOnlyMode
设置为false
了吗?根据此页面,当其设置为true
时,请求实际上并不会被阻止。 - user1429080