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

数据库连接 失败: 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的配置是否正确,允许传入的连接上的实例数据库服务器,否则,使把对本地和远程连接设置。

  1. 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表面积配置
  2. On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections . 关于“ SQL Server 2005的 表面积配置”页上,单击 表面积的配置服务和连接
  3. On the “Surface Area Configuration for Services and Connections” page, expand Database Engine tree, click Remote Connections . 关于“表 面积的配置服务和连接”页上,扩大数据库引擎的 树中,单击远程连接
  4. 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 ,有用时,你刚才尝试连接和验 证与服务器安装完毕后。
  5. 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和命名管道
  6. Click Apply button when done. 点击应用 按钮时,做了。
  7. 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.” 单击确定 按钮时,提示讯息,他说: “更改连接设置将不会生效,直到您 重新启动数据库引擎的服务” 。
  8. On the “Surface Area Configuration for Services and Connections” page, expand Database Engine , then click Service . 关于“表面 积的配置服务和连接”页上,扩大资料库引擎 ,然后单击服务
  9. Click Stop button to stop the SQL Server service. 点击停止 按钮来停止SQL Server服务。
  10. Wait until the MSSQLSERVER service stops, and then click Start button to restart the MSSQLSERVER service. 等到MSSQLServer服务站,然后单击开 始 按钮,重新启动MSSQLServer服务。

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

将其错误修正,错误解决!!(本人遇到的是第二种情况,此情况应特别注意

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值