2017-06-22 104 views
0

我目前开始在ASP.NET MVC中作为Web应用程序在Azure中托管的Web应用程序工作。我创建了一个部署插槽(分段,而不是生产插槽),我想知道该怎么做才能阻止从所有IP地址访问该插槽,除了白名单之外。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。

你知道我应该怎么做以上(也许类似的东西,你尝试和努力)

感谢提到限制访问!

回答

0

不知道在将配置粘贴到问题中时它是否是错字,但是您没有正确关闭<rules>。将最后的<rules>更改为</rules>

+0

对不起,就在这里。我手动在stackoverflow上添加了标签 –