How do I fix the error 'Named Pipes Provider, error 40 - Could not open a connection to' SQL Server'?

Solving this problem is very easy:

  1. Go to control panel.
  2. search for services.
  3. Open Local services window from your search results
  4. Restart your MSSQLSERVER service.

Screenshot of the steps:

Screenshot of the steps


And the simplest solution - check if your slash is back...

I spent about an hour trying to figure out what's wrong with SERVER/INSTANCENAME when everything is configured correctly, named pipes, user access rights... and suddenly it struck me, it's not a slash, it's a backslash (\).

The horror, the shame...


It's a three step process really after installing SQL Server:

  1. Enable Named Pipes SQL Config Manager --> SQL Server Network Consif --> Protocols --> Named Pipes --> Right-click --> Restart

named pipes enabled

  1. Restart the server SQL Config Manager --> SQL Server Services --> SQL Server (SQLEXPRESS) --> Right-click --> Restart

  2. Use proper server and instance names (both are needed!) Typically this would be .\SQLEXPRESS, for example see the screenshot from QueryExpress connection dialog.

enter image description here

There you have it.