'provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
In my project I do have DB in sql server 2005 and its working in local. but when I try to connect remote sql server 2008 R2 by using the credentials I got the following error.
System.Data.SqlClient.SqlException was unhandled by user code
Message="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)"
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=20
LineNumber=0
Number=53
Server=""
State=0
And I enabled the following in remote server
1) Started SQL server, sql browser service using sql server configuration manager.
2) added the sql server, browser exe in to firewall allowed program list.
3) restarted sql server and browser.
4) enabled TCP/IP, Shared memory, Named pipes in SQL server configuration manager
5) I enabled the remote connection for this DB in database property
6) and the connection string in following manner
SqlConn = new SqlConnection(@"Data Source=IP address;Initial Catalog=DbName;
User ID=ID;Password=pwd ");
also while taking the properties of Db using the view current connection property in remote it shows service is unavailable for entries like DBname, authentication mode, network protocol etc...
if any one have this issue before please help.
thanks & regards, Tharadas.
Solution 1:[1]
along with the options enabled in the question I solved the issue by doing the following changes.
1) in Sql connection string added the sql port number(1533 or 1433). 2) add exception for port number in firewall.
Thanks & regards Tharadas k.p
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tharadas das |
