我想利用在 Azure 中托管 Web api 的一些好处,但我希望该 api 是私有(private)的(无法从外部世界访问),因为它只能在内部使用。
我不确定这是否可能。我尝试过从 Visual Studio 进行部署,但 API 托管在 xyz.azurewebsites.net 上,并且可以从任何地方访问。
提前致谢。
最佳答案
您可以通过 web.config 将站点访问限制为特定 IP 地址或地址范围。将一个部分添加到 system.webServer
:
<system.webServer>
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="123.456.0.0" subnetMask="255.255.0.0"/>
</ipSecurity>
</security>
</system.webServer>
更多信息请参见:IP and Domain Restrictions for Windows Azure Web Sites
关于azure - 如何将azure api应用程序部署到专用网络,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41058154/