使用Microsoft Azure限制网站在特定区域打开

时间:2018-10-16 07:33:00

标签: azure networking geolocation azure-web-sites

我已经从GoDaddy购买了域名,并且已经将网站代码托管在Microsoft Azure上,现在我想限制使用Microsoft Azure进行地理定位的网站在特定区域中的运行。

我已通过指定的IP限制在Azure中使用Networking,但是当我这样做时,我的网站到处都停止了工作。

示例:我已经为我的IP地址192.168.1.X / 10配置了IP限制,但是当我添加规则时,它在任何地方都应该只允许/不允许配置的IP地址的地方停止我的服务,并显示403错误。

我也使用了article并配置了我的web.config,但仍然没有帮助。

我该怎么做?

任何曾经做过或有话要说的人都建议我。

谢谢。

1 个答案:

答案 0 :(得分:0)

您可以尝试将规则添加到web.config

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <security>
      <ipSecurity xdt:Transform="RemoveAttributes(allowUnlisted)">
        <add ipAddress="156.85.859.220" allowed="true" xdt:Transform="Insert"/>
      </ipSecurity>
    </security>
  </system.webServer>

您可以找到更多示例here

如果要使用地理过滤,Azure CDN将是最好的选择,您可以根据国家/地区限制端点。