应用服务无法通过 VPN 连接连接到资源

App Service not able to connect to resources through VPN Connection

我在应用服务上有一个 Web API (.NET Core 3.1) 运行,但我无法将数据发送到外部 API Azure 之外的另一台服务器。

虚拟网络网关分配有 VNet 和 2 个外部连接,两者都运行良好(状态已连接)。我可以 ping 服务并从办公室访问资源。

VPN 连接是同一 VNet 中的站点到站点 VPN。它工作正常,如果我 运行 我的 API 在 Azure.

中的虚拟机上,我可以发送数据

看起来应用服务无法像虚拟机那样查看网络。

我应该怎么做才能让应用服务能够使用 VPN 连接?

您似乎想要应用服务访问本地网络中的资源,我想您已经 integrated you app with an Azure virtual network 并在同一个 VNet 中设置了 Site-to-Site VPN。

确保您已将应用设置 WEBSITE_VNET_ROUTE_ALL 设置为 1

When regional VNet Integration is enabled, your app makes outbound calls to the internet through the same channels as normal. The outbound addresses that are listed in the app properties portal are the addresses still used by your app. What changes for your app are the calls to service endpoint secured services, or RFC 1918 addresses go into your VNet. If WEBSITE_VNET_ROUTE_ALL is set to 1, all outbound traffic can be sent into your VNet.

WEBSITE_VNET_ROUTE_ALL is currently not supported in Windows containers.