此 Blog 已经迁移到 http://janlay.com,并停止更新。
This blog was moved to http://janlay.com and stopped updating.

2006-8-12 18:56Zoom全屏解决 ASP.NET 中讨厌的 SQL Server 2005 连接失败的问题

严正声明:本文可以随意转载,但必须保留作者署名及文章来源。如果您不认可这份声明,请勿转载,谢谢。

 ASP.NET 2.0 开发者经常会遇到这么一个奇怪的问题:明明没有安装 SQL Server 2005, 却在应用程序启动时得到错误信息,说连不上 SQL Server 2005, 提示如下:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

这个现象仅出现在通过 IIS 访问的情况下,而通过 File System 方式启动却没问题。

我的办法是,在 <connectionStrings> 后面紧接着加上 <clear/>, 删除所有内置的连接串,然后写上自己的 connectionstring.

另外,有时候远程 SQL Server 机器如果无法获取 IP 地址,也可能会出现这个问题,在使用 VPN Connection 无法解析计算机名时比较多见。解决办法是 Data Source 的值使用 IP 地址,或者在 hosts 中强制解析计算机名。

作者:Author:janlay 分类:Category:Techniques 回复Comments: 引用Trackback: 阅读:Read

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}