您的位置:首页 > 数据库

SQLSERVER2005错误提示:数据库连接失败

2010-10-22 18:29 603 查看
数据库连接
失败: 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. (provider: Named Pipes Provider, error: 40 - Could
not open a connection to SQL Server)

错误:在Microsoft
SQL本土客户:发生错误,而建立一个到服务器的连接。 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.
当连接到SQL Server 2005中,这样的失败
可能造成的事实,即根据默认设置SQL Server不允许远程连接。
Or,
或,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.
当连接到SQL Server 2005中,这样的失败
可能造成的事实,即根据默认设置SQL Server不允许远程连接。
(provider: Named Pipes Provider, error: 40 - Could not open a
connection to SQL Server) (Microsoft SQL Server, Error: 2)

(提供者:命名管道提供商,错误: 40 -无法打开连接到S QLS erver)
( M icrosoftS QLS erver,错误: 2 )

错误原因及解决方法:

一、确保SQL Server
2005的配置是否正确,允许传入的连接上的实例数据库服务器,否则,使把对本地和远程连接设置。

Click Start button, then go to Programs or All
Programs, then select Microsoft SQL Server

2005

, followed by Configuration Tools
.
单击开始按钮,然后到程序或所有程序,然后选择了Microsoft SQL Server 2005
,其次是配置工具
。 Click
and run the SQL Server Surface Area Configuration
.

击和运行SQL Server表面积配置


On the “SQL Server
4000
2005 Surface Area
Configuration” page, click Surface Area Configuration for
Services and Connections

.
关于“ SQL Server 2005的
表面积配置”页上,单击
表面积的配置服务和连接


On the “Surface Area Configuration for Services
and Connections” page, expand Database Engine
tree,
click Remote Connections
.
关于“表
面积的配置服务和连接”页上,扩大数据库引擎的
树中,单击远程连接


Select Local and remote connections
, or Local connections only
which applicable only if
there is no remote system tries to connect to the SQL Server, useful
when you just trying to connect and authenticate with the server after
installing.
选择本地和远程连接
,或本地
连接只

,其中只适用于如果没有远程系统会尝试连接到SQL Server ,有用时,你刚才尝试连接和验
证与服务器安装完毕后。

Select the appropriate protocol to enable to
local and/or remote connections environment.
选择适当的议
定书,使本地和/或远程连接的环境。 To ensure
maximum compatibility, select Using both TCP

/IP and named
pipes

.
以确保最高的相容性,选择使用TCP / IP和命名管道


Click Apply
button when done.
点击应用
按钮时,做了。

Click OK
button when prompted
with the message saying that “Changes to Connection Settings will not
take effect until you restart the Database Engine service.”
单击确定
按钮时,提示讯息,他说: “更改连接设置将不会生效,直到您
重新启动数据库引擎的服务” 。

On the “Surface Area Configuration for Services
and Connections” page, expand Database Engine
, then
click Service
.
关于“表面
积的配置服务和连接”页上,扩大资料库引擎
,然后单击服务


Click Stop
button to stop the
SQL Server service.
点击停止
按钮来停止SQL
Server服务。

Wait until the MSSQLSERVER service stops, and
then click Start
button to restart the MSSQLSERVER
service.
等到MSSQLServer服务站,然后单击

按钮,重新启动MSSQLServer服务。

二、web.config文
件中的数据库连接串中的主机IP或数据库名及服务名错误!!

将其错误修正,错误解决!!(本人遇到的是第二种情况,此情况应特别注意
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐