Azure 虚拟网络混合连接

标签 azure azure-virtual-network

我在网络内设置了 Azure 虚拟网络和 VM。我已在虚拟机上安装了混合连接管理器应用程序。

我还有一个 Azure 应用服务,并且我在它和 VM 之间创建了混合连接,并且它们都声称它们能够愉快地相互连接。

还在虚拟机上我安装了一个正在监听 http://localhost:1234 的应用程序

有人可以告诉我我使用应用服务中的哪个 IP 来与 http://localhost:1234 进行通信吗?在虚拟机上?例如是[VM内部IP]:1234还是[VM公共(public)IP]:1234,还是其他什么。目前没有任何消息,所以我想确保 IP 地址不是问题。

最佳答案

只需使用虚拟机的计算机名称。例如,从应用服务中的代码调用 SQLSRV009:1234。门户中的混合连接定义应反射(reflect)相同的名称(与计算机名称相同,与您从代码中调用的名称相同)。

查看这份写得很好的指南,了解完整情况 — https://learn.microsoft.com/en-us/azure/biztalk-services/integration-hybrid-connection-create-manage

It is possible to set a Hybrid Connection endpoint to an IP address. If you use an IP address, you may or may not reach the on-premises resource, depending on your client.

The Hybrid Connection depends on the client doing a DNS lookup. In most cases, the client is your application code. If the client does not perform a DNS lookup, (it does not try to resolve the IP address as if it were a domain name (x.x.x.x)), then traffic is not sent through the Hybrid Connection.

For example (pseudocode), you define 10.4.5.6 as your on-premises host: The following scenario works:
Application code -> GetHostByName("10.4.5.6") -> Resolves to 127.0.0.3 -> Connect("127.0.0.3") -> Hybrid Connection -> on-prem host

The following scenario doesn't work:
Application code -> Connect("10.4.5.6") -> ?? -> No route to host

还要让您的应用程序监听 0.0.0.0 或私有(private) IP,因为我不太确定 localhost 是否可以与 HC 配合使用。

为什么不对 Web 应用程序使用 VNET 集成?您需要做的就是在 VNET 中创建基于路由 (IKEv2) VPN 网关,如下所示 — https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet

关于Azure 虚拟网络混合连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47290907/

相关文章:

azure - 使用 Cisco-VPN-Client 连接到客户端 VPN 后很快就失去了通过 RDP/Bastion 对 Windows VM 的访问权限

azure - 上传到 Azure DevOps 存储库的源代码是否静态加密?

azure - 如何将 WebPublish 与 Github 操作结合使用到 .NET Core 应用程序的 IIS 服务器?

c# - 使用 Jetbrains Rider 和 Azure Toolkit 以及本地设置部署 Azure Function

azure - 如何将辅助角色添加到虚拟网络

azure - Microsoft Defender 云版 : "Subnets should be associated with a network security group" status is Not Applicable for a private endpoints subnet

azure - 在azure中创建多个子网

Azure Pipelines - 无法建立连接,因为目标计算机主动拒绝它

python - 使用 python 获取 vnet 的所有属性 |列表函数仅给出名称

azure - Azure VM 中的 Thingsboard 未监听指定端口