【问题标题】:get A network-related error SQL Server 2008 on Azure Virtual Matchine在 Azure 虚拟机上获取与网络相关的错误 SQL Server 2008
【发布时间】:2013-08-13 17:09:02
【问题描述】:

我对 Azure 很陌生。我创建了托管 SQL Server 2008 的 Azure 虚拟机。

我的应用程序使用 ASP.NET MVC 4 并托管在 Amazon Web Service 上。该应用程序运行良好,我可以使用 Management Studio 连接到数据库。 但是,我现在有时会收到此错误。

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 Azure一样实现与数据库的重试连接,我现在使用传统的连接字符串和NHibernate,用域名(abc.cloudapp.net)连接SQL Server 或者如果我们在 Azure 虚拟机上使用 SQL Server 2008,还有其他问题需要考虑。

正如@SqlACID 的评论,这是我当前的连接字符串。 服务器=domain.cloudapp.net;数据库=db;用户ID=uid;密码=pwd;出于安全原因,我将实际值更改为 domain、db 和 pwd。

然而,这种情况昨天发生了三次。

非常感谢。

【问题讨论】:

  • 你能发布你的连接字符串吗?
  • @SqlACID 我添加了连接字符串,谢谢

标签: sql-server-2008 azure


【解决方案1】:

与 SQL Server 的连接可能有问题。

可以

  1. 数据库离线。
  2. 使用的连接字符串无效(用户名或密码不匹配)。
  3. 实例 DB 名称不正确。 (拼写错误)

请检查您的 web.config 文件。

A very Good link of Possible errors with answers.

More error list here

MSDN Similar Question

Stack similar Question

【讨论】:

  • 非常感谢@Luv 的快速回复。我认为用户名和密码是正确的,因为我可以连接到数据库并且它现在正在工作。但是有时我得到了错误。
猜你喜欢
  • 2019-10-29
  • 2020-02-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-22
  • 2017-12-09
相关资源
最近更新 更多