i当前开始在ASP.NET MVC中使用Web应用程序,该应用程序以Web应用程序为azure。我创建了一个部署插槽(分期,而不是生产插槽(,我想知道我该怎么办才能从所有IP地址中阻止该插槽上的访问权限,但白色列出了。
我通过在其中添加代码的这一部分尝试了从Web配置尝试。
<rules>
<rule name="Block unauthorized traffic to staging sites" stopProcessing="true">
<match url=".*" />
<conditions>
<!-- Enter your staging site host name here as the pattern-->
<add input="{HTTP_HOST}" pattern="^mysite-staging." />
<!-- Enter your white listed IP addresses -->
<add input="{REMOTE_ADDR}" pattern="123.123.123.1" negate="true"/>
<!-- Add the white listed IP addresses with a new condition as seen below -->
<!-- <add input="{REMOTE_ADDR}" pattern="192.255.42.2" negate="true"/> -->
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden"
statusDescription="Site is not accessible" />
</rule>
</rules>
但是在部署时,它从服务器返回此错误:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070032
Config Error The configuration section 'rules' cannot be read because it is missing a section declaration
IIS版本10.0。
您知道我应该如何限制上述访问(也许您尝试过的类似的东西(
谢谢!
不确定当您将配置粘贴到问题中时是否是错字,但是您无法正确关闭<rules>
。将最终<rules>
更改为</rules>