1

Here is my connection string to a remote SQL Server :

<connectionStrings>
    <add name="WebSiteDB"
         connectionString="Server=.MSSQLSERVER2012;Database=mydb;User Id=myid;Password=mypw;"   
         providerName="System.Data.SqlClient" />
</connectionStrings>

When I open my connection it throws an exception :

Named Pipes Provider, error: 40

Can someone help me?

1
  • When you installed SQL, if you're using Express, it has NO networking allowed. You need to go to SQL Server settings and enable a transport (net pipes or TCP). Commented Dec 26, 2016 at 21:29

2 Answers 2

1

The format of the Server attribute is Server=myServerName\myInstanceName. So I think that you need a backslash after the dot, i.e. Server=.\MSSQLSERVER2012

If that doesn't work, then here are two websites that give you connection string formats https://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx

https://www.connectionstrings.com/sql-server-2012/

Sign up to request clarification or add additional context in comments.

13 Comments

Seems like it is better but i have now this exeption : "SQL Network Interfaces, error: 26"
Are you connecting to a full version of SQL Server, or Express?
Full version SQLserver 2012
The "Host" therm is strange, that's the server right ?
The host will specify the SQL Server instance. Given that it is on a remote machine, it does seem strange to use a dot in front. Have you tried removing the dot and just specifying the instancename i.e. Server=MSSQLSERVER2012?
|
0

I corrected an error like this by restarting sql server services. Restart MSSQLSERVER service in data server services.

Sql network interface error :26 is for wrong server name or instance name. mostly instance name

5 Comments

Still the same exception
Can you see database engine in you local system by sql server management Stadio?
Cant connect to the server Manager, it gives me the same exception
Check these : server name or instance name. Are you sure these are correct?
If windows firewall is off then create an exception for port 1433 and If firewall is enabled on the server, you need to put UDP port 1434 into exception.