Azure 连接字符串异常“发生与网络相关或特定于实例的错误”

发布于 2024-11-13 06:19:51 字数 1071 浏览 3 评论 0原文

尝试使用以下连接字符串连接到 SQL Azure 时

服务器=tcp:SERVER.database.windows.net,1433;数据库=DBNAME;用户ID=USER@SERVER;密码=PASSWORD;Trusted_Connection=False;Encrypt=True

从本地运行的 ASP.NET MVC 应用程序我收到此异常:

{“与网络相关或 发生特定于实例的错误 建立与 SQL 的连接 服务器。找不到服务器或 无法访问。验证 实例名称正确且 SQL 服务器配置为允许远程 连接。 (提供者:TCP 提供者, 错误:0 - 不知道这样的主机。)"}

我意识到这是一个相对通用的错误消息。

在解决问题时,我通过 Windows 防火墙在端口 1433 上打开了入站和出站流量:

netsh advfirewall 防火墙添加规则名称=“打开端口 80”dir=in 操作=允许协议=TCP localport=80

我已将 Azure 防火墙配置为接受来自我的 IP 地址的连接以及“允许其他 Windows Azure 服务访问此服务器” ”。我可以通过 SQL Server Management Studio 2008 R2 连接到 Azure 数据库。我无法通过以下方式远程登录到数据库

telnet SERVER.database.windows.net 1433

相关 Stack Overflow 问题:

我觉得我一定忽略了一些基本的东西。我还遗漏了其他故障排除步骤吗?

When attempting to connect to SQL Azure with the following connection string

Server=tcp:SERVER.database.windows.net,1433;Database=DBNAME;User ID=USER@SERVER;Password=PASSWORD;Trusted_Connection=False;Encrypt=True

from a locally running ASP.NET MVC application I receive this exception:

{"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: TCP Provider,
error: 0 - No such host is known.)"}

I realize this is a relatively generic error message.

In troubleshooting the problem I have opened inbound and outbound traffic through my Windows firewall on port 1433:

netsh advfirewall firewall add rule name=”Open Port 80” dir=in action=allow protocol=TCP localport=80

I have configured the Azure firewall to accept connections from my IP address as well to "Allow other Windows Azure services to access this server." I can connect to the Azure database via SQL Server Management Studio 2008 R2. I cannot telnet to the database via

telnet SERVER.database.windows.net 1433

Related Stack Overflow Questions:

I feel like I must be overlooking something basic. Are there other troubleshooting steps I have missed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2024-11-20 06:19:51

不好意思地说,这个问题是因为我粗略地指认了服务器名称而引起的。显然,这些天我真的不擅长单独编程。感谢上面所有的评论,这些评论让我不断问自己我错过了什么。

Embarrassed to say that that this issue was caused because I fat fingered the server name. Apparently, I really am terrible at solitary programming these days. Thank you to all of the comments above which caused me to keep asking myself what am I missing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文