How can I fix error 40 when connecting the local server in sql Server

8

This is the error that ne comes up:

TITLE: Connect to Server
------------------------------

Cannot connect to DESKTOP-1N1OK6F.

------------------------------
ADDITIONAL INFORMATION:

Error relacionado con la red o específico de la instancia mientras se
establecía una conexión con el servidor SQL Server. 

No se encontró el servidor o éste no estaba accesible. 
Compruebe que el nombre de la instancia es correcto 
y que SQL Server está configurado para admitir conexiones remotas. 

(provider: Named Pipes Provider, error: 40 - No se pudo abrir una 
 conexión con SQL Server) (Microsoft SQL Server, Error: 2)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476

------------------------------

El sistema no puede encontrar el archivo especificado

------------------------------
BUTTONS:

OK
------------------------------
    
asked by miguel 25.01.2016 в 01:19
source

3 answers

5

You are trying to connect using the Named Pipes protocol, which is disabled by default.

Solution:

  • Enter the Sql Server Configuration Manager
  • Expand SQL Server Network Configuration
  • Click on Protocols for MSSQLSERVER
  • Right click on Named Pipes
  • Enable
  • Restart the service
  •     
    answered by 29.01.2016 в 01:47
    2

    This error is very common and very easy to solve: You only have to activate the services "SQL Server" and "SQL Server" in the "Sql Server Configuration Manager". I leave you some photos:

    I hope you solve your problem.

    Greetings!

        
    answered by 29.01.2016 в 01:41
    0

    Keep in mind to use a backslash in the connection chain.

    Incorrect:

    var conexion = "Data Source=Maquina/instancia.." ;

    Correct:

    var conexion = @"Data Source=Maquina\instancia..";
    
        
    answered by 20.07.2017 в 21:39