0

我对 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 或者如果我们使用 SQL Server 2008 上还有其他问题需要考虑Azure 虚拟机。

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

但是,这种情况昨天发生了三次。

太感谢了。

4

1 回答 1

0

与 SQL Server 的连接可能存在问题。

有可能

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

请检查您的 web.config 文件。

可能错误与答案的非常好的链接。

更多错误列表在这里

MSDN 类似问题

堆叠类似的问题

于 2013-07-16T08:03:12.677 回答