Azure 中的 IP 安全和 Always On 设置

IP Security and Always On Setting in Azure

我在 Azure 网络应用程序上有一个连续的 WebJob 运行,这需要我继续保持该应用程序 "Always On." 在同一个应用程序上,我设置了 web.config文件以阻止带有 NotFound 错误的未列出的 IP:

<security>
  <ipSecurity allowUnlisted="false" denyAction="NotFound">
    <add ipAddress="123.456.789.123" allowed="true"/> <!--office-->
    <add ipAddress="168.62.180.0" allowed="true"/> <!--azure (for Always On setting)-->
  </ipSecurity>
</security>

显然,Always On 设置会导致 Azure 每 5 分钟在后台对网站执行一次 ping 操作,但安全选项会阻止 Azure 的 ping 操作,这会使错误日志变得混乱。不过,其他列入白名单的 IP 地址可以正常访问该应用程序;只是 Azure ping 被阻止。

这是其中一个被阻止的 ping 的错误日志的屏幕截图:

任何有关如何允许 Azure ping 的见解都将不胜感激!

允许这两个 IP 对我有用。由于 Always on 的 ping 来自“::1”ip,但是我也将“127.0.0.1”添加到列表中。

<add allowed="true" ipAddress="::1" />
<add allowed="true" ipAddress="127.0.0.1" />