gpt4 book ai didi

sql-server - Azure错误: A network-related or instance-specific error occurred while establishing a connection to SQL Server

转载 作者:行者123 更新时间:2023-12-04 01:07:07 25 4
gpt4 key购买 nike

我有通过 Microsoft Azure 平台托管的 SQL 服务器和 Web 应用程序。当我从本地网络运行Web应用程序(并尝试连接azure sql服务器)时,我不断收到上述错误,但是我从未在azure Web应用程序服务上遇到问题(即在azure上托管我的Web应用程序之后)

我知道这个错误很熟悉。但在这种情况下,这似乎很奇怪。我已经检查过以下内容,

  1. SQL 连接管理正确。 (我正在使用 ADO.Net)
  2. 所有网关 IP 均已针对 azure sql 列入白名单。
  3. 没有防火墙阻止我的专用网络。

任何帮助将不胜感激。

最佳答案

来自 Mihaela 的评论:您需要在服务器名称前面添加“tcp:”。 IE。 tcp:<servername>.database.windows.net

<小时/>

编辑:

这在[文档] ( https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx ) 中指定

Data Source must use the TCP format or the Named Pipes format.

TCP format is as follows:

•tcp:\

•tcp:,

The TCP format must start with the prefix "tcp:" and is followed by the database instance, as specified by a host name and an instance name.

The host name MUST be specified in one of the following ways:

•NetBIOSName

•IPv4Address

•IPv6Address

The instance name is used to resolve to a particular TCP/IP port number on which a database instance is hosted. Alternatively, specifying a TCP/IP port number directly is also allowed. If both instance name and port number are not present, the default database instance is used.

关于sql-server - Azure错误: A network-related or instance-specific error occurred while establishing a connection to SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38694867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com