6

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.

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. ( provider: Named Pipes Provider, error: 40 – could not open a connection to SQL server. )


This error occurs only from XP machines but it works fine from Win. 7 Machines with the same connection string:

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

Each time I try something I get the same result, win. 7 machines work fine but XP machines don't.

Note: There's another application works from XP machines that uses another database on the same SQL Server and it's working fine.

DForck42
  • 19,789
  • 13
  • 59
  • 84
Ehab
  • 566
  • 6
  • 24
  • Take a look at http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx – niktrs Aug 01 '11 at 11:09
  • @Ehab - were you ever able to solve it? – sfuqua Dec 07 '11 at 18:49

1 Answers1

1

Make sure the SQL Browser is enabled and running on your remote machine. You'll probably want to leave named pipes enabled.

DanDan
  • 10,462
  • 8
  • 53
  • 69