Provider named pipes provider error 40 could not open a connection to SQL Server error 2 [duplicate]

When I am trying to connect to my database in SQL Server Management Studio, I getting this error:

Provider named pipes provider error 40 could not open a connection to SQL Server error

After checking several answers on SO, I opened the SQL Server Configuration Manager

I found SQLSERVER (SQLEXPRESS) and all three options state >> STOPPED

I tried it starting by right clicking on it, but i got below error:

The request failed or the service did not respond in a timely fashion

How can I connect to the instance???


Well I have an easy solution for your question. Follow the steps:

  1. Go to SQL Server Configuration manager
  2. SQL Server Network Configuration:
  3. Protocol for MSSQLSERVER
  4. In the right pane split page you will have to disable VIA as follows
    1. Shared Memory - Enable
    2. Named Pipes - Enable
    3. TCP/IP - Enable
    4. VIA - Disable

Search for services in control panel, there you will find and entry View Local Services in Admin tool section

select it that will show a window with all services in your system, find your service SQLEXPRESS and click on Start. It should start your server instance :)

enter image description here


In Sql Server Configuration Manager program, start SQL SERVER, enable the TCP/IP connection. After, allow the port in the firewall to be sure that's ok.


It's a generic error so it can be a lot of things. I got this error once and when I added port number (1433) to my connection string everything started to work again.

<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=Server,1433;Initial Catalog=Test;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>

I have provided steps to fix your issue Provider named pipes provider error 40 could not open a connection to SQL Server error as below:

  1. Confirm for working fine SQL Server Services services.
  2. Confirm for working fine SQL Server (MSSQLSERVER).
  3. Confirm for working fine SQL Server Browser.
  4. Delete all your previous Aliases and now create new aliases as per your requirements.
  5. Now assign your SQL Server Default Port 1433
  6. Now click on Client Protocols in instance, click on TCP/IP in right pane, now click on mouse right click, open Property, here you can check for your default port of SQL 1433
  7. Run your SQL Server Management Studio, then right click, click on property option and then click on Connections on tab, now check for Allow remote Connections to this server.
  8. Confirm for Ping IP Host or not
  9. Check for your Firewall setting not to blocking your SQL Server port