[英]provider: Named Pipes Provider, error: 40 – could not open a connection to SQL server.
I developed a .net application that depends on a sql server database, the database was on the local machine used for development of the application. 我开发了一个依赖于sql server数据库的.net应用程序,该数据库位于用于开发应用程序的本地机器上。
When I moved the database to a remote machine and changed the connection string I got the following error: 当我将数据库移动到远程计算机并更改连接字符串时,我收到以下错误:
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 default settings SQL server does not allow remote connection. 连接到SQL Server 2005时建立与服务器的连接时发生错误,此错误可能是由于在默认设置下SQL Server不允许远程连接。 ( provider: Named Pipes Provider, error: 40 – could not open a connection to SQL server. )
(提供者:命名管道提供程序,错误:40 - 无法打开与SQL服务器的连接。)
This error occurs only from XP machines but it works fine from Win. 此错误仅发生在XP计算机上,但它可以在Win中正常工作。 7 Machines with the same connection string:
7具有相同连接线的机器:
connectionString="Data Source=ot;Initial Catalog=sp_warehouse;User ID=fu;Password=bar" connectionString =“Data Source = ot; Initial Catalog = sp_warehouse; User ID = fu; Password = bar”
I tried the following to troubleshoot the problem: - Disabled Named Pipes service from the server. 我尝试了以下方法来解决问题: - 从服务器禁用命名管道服务。 - Added an exception in the server firewall for the SQL Server port 1433 - Disabled the firewall on the server completely - Added this parameter in the connection string: Network Library=DBMSSOCN;Persist Security Info=True
- 在SQL Server端口1433的服务器防火墙中添加了一个例外 - 完全禁用了服务器上的防火墙 - 在连接字符串中添加了此参数:Network Library = DBMSSOCN; Persist Security Info = True
Each time I try something I get the same result, win. 每次我尝试一些东西,我都会得到相同的结果,赢了。 7 machines work fine but XP machines don't.
7台机器工作正常,但XP机器没有。
Note: There's another application works from XP machines that uses another database on the same SQL Server and it's working fine. 注意:还有另一个应用程序可以在XP机器上运行,它在同一个SQL Server上使用另一个数据库并且工作正常。
Make sure the SQL Browser is enabled and running on your remote machine. 确保在远程计算机上启用并运行SQL Browser。 You'll probably want to leave named pipes enabled.
您可能希望启用命名管道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.