将asp.net Web应用程序与SQL Server 2005连接时出错 [英] Error while connecting asp.net web application with sql server 2005

查看:50
本文介绍了将asp.net Web应用程序与SQL Server 2005连接时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

建立与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)

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)

推荐答案

根据您提供给我们的信息,我们不确定.
您可能需要查看连接字符串,并确保它指向承载数据库的valis SQL Server实例.

尝试使用服务器资源管理器"窗格在VS中建立连接:
1)打开服务器资源管理器.
2)右键单击数据连接",然后选择添加连接"
3)在随后的对话框中,选择您的数据源和数据库,指定安全信息,然后按测试连接"按钮.
4)连接正常后,按确定"
5)在服务器资源管理器"窗格中突出显示您的数据库,然后查看属性"窗格.将显示一个连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中.
From the info you have given us, we can''t be sure.
You need to look at your connection string, probably, and make sure that it points to a valis SQL server instance, that hosts your database.

Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.


您的连接字符串有误.

通过以下步骤创建连接字符串:

1.创建一个以"udl"为扩展名的文件
2.双击文件,然后按照向导进行操作.
3.选择用于SQL Server的Microsoft OLEDB Provider"
4.在连接"选项卡中,选择数据库,输入sql服务器凭据,然后单击测试连接"按钮.
5.在记事本中打开.udl文件.它将包含连接字符串.在配置文件中使用它
Your connection string is wrong.

Create a connection string with these steps:

1. create a file with any name but ''udl'' as extension
2. Double click the file and follow the wizard.
3. Select ''Microsoft OLEDB Provider for SQL Server''
4. In ''Connection'' tab, select the database , enter sql server credentials and click ''test connection '' button.
5. Open the .udl file in notepad. It will contain the connection string. Use this in your config files



这篇关于将asp.net Web应用程序与SQL Server 2005连接时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆