Home > DeveloperSection > Forums > The same connection succeed and fails in different .net solutions
Ankit Singh

Total Post:341

Points:2389
Posted on    June-19-2013 3:53 AM

 ADO.Net ADO.Net 
Ratings:


 1 Reply(s)
 863  View(s)
Rate this:
Hi Expert,

I have two .net solutions. They both have this code:

var connectionString = "Server = ServerName; Database = DatabaseName; Trusted_Connection=True;"
var connection = new SqlConnection(connectionString);
connection.Open();
connection.Close();

And they both use complitely the same connectionString. And they connect to MSSQL Server;

And in the first solution connection.Open() succeeded and in the second one it failed. Error message : Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

And every time I create new solution it fails. So this connection only works in one specific solution. And also, my teammates tested this and didn't have such issues.

Can you help with hints why it can be so?


Sumit Kesarwani

Total Post:378

Points:2694
Posted on    June-19-2013 8:42 AM

Hi Ankit,

Open Sql Server Configuration Manager and make sure that the Named Pipes option is enabled for your Sql server instance.

Don't want to miss updates? Please click the below button!

Follow MindStick