【Azure 应用服务】遇见“无法创建hybrid connection for App Service”的解决办法

本文涉及的产品
云解析DNS-重点域名监控,免费拨测 20万次(价值200元)
简介: 【Azure 应用服务】遇见“无法创建hybrid connection for App Service”的解决办法

Hybrid Connection (混合连接) 在两个联网应用程序之间启用了双向、请求-响应和二进制流通信以及简单的数据报流。通过混合连接,可以实现应用部署在公网环境中,而数据库保存在本地私网环境中,他们之间通过(HCM: 混合连接器)实现双向通信。

工作原理

混合连接要求将中继代理部署到可以同时到达所需终结点和 Azure 的位置。 中继代理混合连接管理器 (HCM) 通过端口 443 调用 Azure 中继。 在 Web 应用站点上,应用服务基础结构还代表应用程序连接到 Azure 中继。 通过已联接的连接,应用可以访问所需的终结点。 连接使用 TLS 1.2 来确保安全,使用共享访问签名 (SAS) 密钥进行身份验证和授权。

问题描述

在参照设置文档 “Azure 应用服务混合连接” 一步一步配置好HCM(Hybrid Connection Manager: 混合连接管理器)后,使用数据库的IP地址作为配置的Endpoint,在HCM中显示,状态为connected,但是应用中连接DB时,出现错误。无法动过HCM的方式成功连接到DB。

配置显示成功截图:

应用错误消息:

an error occured: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

问题解答

客户端无法连接到其终结点的主要原因是使用 IP 地址而不是 DNS 名称指定了终结点

如果应用无法访问所需的终结点,而你使用了 IP 地址,请改为使用在运行 HCM 的主机上有效的 DNS 名称。 另请检查 DNS 名称是否能够在运行 HCM 的主机上正确解析。 确认运行 HCM 的主机是否与混合连接终结点建立了连接。

If your status says Connected but your app cannot reach your endpoint then:

  • make sure you are using a DNS name in your Hybrid Connection. If you use an IP address then the required client DNS lookup may not happen. If the client running in your web app does not do a DNS lookup, then the Hybrid Connection will not work
  • check that the DNS name used in your Hybrid Connection can resolve from the HCM host. Check the resolution using nslookup EndpointDNSname where EndpointDNSname is an exact match to what is used in your Hybrid Connection definition.
  • test access from your HCM host to your endpoint using the PowerShell command Test-NetConnection EndpointDNSname -P Port If you cannot reach the endpoint from your HCM host then check firewalls between the two hosts including any host-based firewalls on the destination host.

解决办法

把配置在HCM连接中的Endpoint中改为数据库的主机名,如果是域环境,必须是完整的,可解析的DNS。(安装HCM的机器和真实的DB机器之间可以成功nslookup 且 test-netconnection 成功)

 

参考文档

Azure 应用服务混合连接:https://docs.azure.cn/zh-cn/app-service/app-service-hybrid-connections#troubleshooting

Using Azure App Services with Hybrid Connections:https://www.cnblogs.com/lulight/articles/14786533.html

相关文章
|
2月前
|
Java 应用服务中间件 API
【App Service】部署War包到Azure云上遇404错误
Java应用部署至Azure App Service for Windows后报404,本地运行正常。经排查,日志提示类文件版本不兼容:应用由Java 17(class file version 61.0)编译,但环境仅支持到Java 11(55.0)。错误根源为Java版本不匹配。调整App Service的Java版本至17后问题解决,成功访问接口。
152 1
|
2月前
|
存储 Linux 网络安全
【Azure App Service】Root CA on App Service
Azure App Service for Windows应用连接外部SSL服务时,需确保其证书由受信任的根CA颁发。多租户环境下无法修改根证书,但ASE(单租户)可加载自定义CA证书。若遇证书信任问题,可更换为公共CA证书或将应用部署于ASE并导入私有CA证书。通过Kudu的PowerShell(Windows)或SSH(Linux)可查看当前受信任的根证书列表。
104 13
|
3月前
|
API 网络架构 容器
【Azure Container App】查看当前 Container App Environment 中的 CPU 使用情况的API
在扩展 Azure Container Apps 副本时,因 Container App Environment 的 CPU 核心数已达上限(500 cores),导致扩展失败。本文介绍如何使用 `az rest` 命令调用 Azure China Cloud 管理 API,查询当前环境的 CPU 使用情况,并提供具体操作步骤及示例。
146 16
|
3月前
|
数据安全/隐私保护
【Azure Function App】PowerShell Function 执行 Get-AzAccessToken 的返回值类型问题:System.String 与 System.Security.SecureString
将PowerShell Function部署到Azure Function App后,Get-AzAccessToken返回值类型在不同环境中有差异。正常为SecureString类型,但部分情况下为System.String类型,导致后续处理出错。解决方法是在profile.ps1中设置环境变量$env:AZUREPS_OUTPUT_PLAINTEXT_AZACCESSTOKEN=false,以禁用明文输出。
112 1
|
开发工具 数据安全/隐私保护 安全
远程调试 Azure Web App
当我们将 Web App 部署在 Azure 上时,如果能够实现远程调试,将会极大的提高我们修复 bug 的效率。Visual Studio 一贯以功能强大、易用著称,当然可以实现基于 Azure 应用的创建、发布和调试。
1250 0
|
2月前
|
缓存 移动开发 JavaScript
如何优化UniApp开发的App的启动速度?
如何优化UniApp开发的App的启动速度?
511 139