How do I fix the error 'Named Pipes Provider,

2019-01-01 08:19发布

I can't seem to connect to my database from a site. I get this error:

Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

I tried using the local IP address to connect as well as a public one. I've tried:

  1. Yes, the site can communicate with the server
  2. Named pipes/TCP is enabled.
  3. Remote connections are allowed.
  4. Windows Firewall is off
  5. Created an exception for port 1433 in Windows Firewall.
  6. Enabled everything in SQL Server Configuration Manager.

What else can I do here?

27条回答
妖精总统
2楼-- · 2019-01-01 09:01

In my case, I opened SQL Server Management Studio and searched for SQLEXPRESS in my Database engine. It had two instances and I selected the correct one.

enter image description here

查看更多
低头抚发
3楼-- · 2019-01-01 09:04

For me it was a Firewall issue.

First you have to add the port (such as 1444 and maybe 1434) but also

C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe

and

%ProgramFiles%\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Binn\SQLAGENT.EXE

The second time I got this issue is when I came back to the firewall, the paths were not correct and I needed to update form 12 to 13! Simply clicking on browse in the Programs and Services tab helped to realise this.

Finally, try running the command

EXEC xp_readerrorlog 0,1,"could not register the Service Principal Name",Null

For me, it returned the error reason

查看更多
唯独是你
4楼-- · 2019-01-01 09:05

Try the following steps:

  1. Open Services window (open "run box" and type services.msc).

  2. Looking for SQL services (with SQL prefix).

  3. Start them (if cannot start. Goto step 4).

  4. Right_click to each service -> Properties -> Change to tab "Log on"-> choise log on as "Local ..." -> 0K. Then start SQL services again.

Try Open SQL and connect database.

查看更多
栀子花@的思念
5楼-- · 2019-01-01 09:06

in my case, i had a standalone server, i changed the sql server port default port 1433 in configuration manager to some number and restarted the sql serve service to take effect,i was able to connect to the sql server through management studio if i login to the server. but i was not able to connect from my local machine through sql server, i was getting the error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and

that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)

I checked and verified all the below

-Named pipes/TCP is enabled. -Remote connections are allowed. -Windows Firewall is off -Created an exception for portin Windows Firewall( this was not necessary in my case as the server is in same subnet network). -Enabled everything in SQL Server Configuration Manager.

then i chnaged back the port number to default 1433 and restarted the sql server service, and the issue got resolved and i am able to connect the sql server from my local management studio.

查看更多
残风、尘缘若梦
6楼-- · 2019-01-01 09:06

I have suggested below steps to resolve your issue How do I fix the error 'Named Pipes Provider, error 40 - Could not open a connection to' SQL Server'

  1. Check for working fine SQL Server Services services or not.
  2. Also check for working in good condition SQL Server (MSSQLSERVER).
  3. Also check for working fine SQL Server Browser.
  4. Delete all earlier Aliases, now create new aliases as per your requirements.
  5. Now check for working of SQL Server Default Port 1433
  6. Next click on Client Protocols in instance, then click on TCP/IP, now click on mouse right click, open the Property, here you can make assure your working fine your default port SQL 1433.
  7. Open your SQL Server Management Studio, then right click, click on "Property" option and then click on Connections tab, then finally tick for Allow remote Connections to this server.
  8. Check for right working or your Ping IP Host.
查看更多
裙下三千臣
7楼-- · 2019-01-01 09:07

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

查看更多
登录 后发表回答