Azure 混合连接管理器不起作用 [英] Azure hybrid connection Manager does not work

查看:23
本文介绍了Azure 混合连接管理器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求

我有一个需要相互通信的本地 SQL Server 和一个 Azure webApp 服务.我在与 SQL 服务器位于同一 LAN 的另一台计算机上安装了混合连接管理器.让我们将此计算机称为连接电脑.

I have an On-Premise SQL Server and an Azure webApp Service that needs to talk each other. I installed Hybrid Connection Manager on another computer which is in the same LAN as the SQL server. Let's refer this computer as the Connection PC.

工作部分

  • 安装和配置很简单,混合连接的状态显示为已连接.
  • 在 localhost 上测试了 WebApp,它运行良好.这意味着 asp.net 代码没有问题
  • 连接PC上的SSMS可以访问和查询SQL DB
  • 我在连接 PC 本身上安装了一个测试 SQL 数据库,并使用 WebApp 与测试数据库对话,它工作正常.

问题

在 localhost 上测试成功后,我将 ASP.Net WebApp 发布到 Azure,它给出了以下错误:

After tested ok on localhost, I published ASP.Net WebApp to Azure, it gave following error:

与 SQL Server 建立连接时出现与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接.(提供者:命名管道提供者,错误:40 - 无法打开与 SQL Server 的连接)

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

故障排除尝试

  • 这是否意味着混合连接管理器必须安装在运行 SQL Server 的同一台计算机上?
  • 我确实尝试在 SQL Server 上安装 HCM,但它说它不能与 Win2008R2 一起使用.连接PC上有win2012.所以它可以有HCM.我只是没有时间将 SQL Server 迁移到另一台服务器.所以我希望 HCM 不必在 SQL 服务器上.

连接字符串

在我的webapp中,连接字符串如下.

In my webapp, the connection string is as follows.

connectionString="metadata=res:///ScaleDataModel.csdl|res:///ScaleDataModel.ssdl|res://*/ScaleDataModel.msl;provider=System.Data.SqlClient;provider 连接字符串="数据源=WIN2008R2DataPlus;初始目录=DataPlus;持久安全信息=True;用户id=test;密码=testpass;multipleactiveresultsets=True;应用名称=EntityFramework"providerName="System.Data.EntityClient"

connectionString="metadata=res:///ScaleDataModel.csdl|res:///ScaleDataModel.ssdl|res://*/ScaleDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=WIN2008R2DataPlus;initial catalog=DataPlus;persist security info=True;user id=test;password=testpass;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient"

推荐答案

混合连接通过 TCP 端口进行通信,因此您需要在连接字符串中指定侦听静态端口,例如:

Hybrid Connection communicates via TCP ports thus you need to specify the listening static port in your connection string like:

数据源=服务器名称:端口

Data source=ServerName:Port;

另外这里是一篇关于您在使用混合连接时可能遇到的所有问题.

Also here is an actually detailed article about the all problems you may encounter while working with Hybrid Connections.

希望这对您有所帮助.

这篇关于Azure 混合连接管理器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆