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:08

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...

查看更多
临风纵饮
3楼-- · 2019-01-01 09:08

I tried pretty much everything on this page but I had some underlying issues which were actually what needed to be resolved. I was unable to do certain things like open SQL Server Configuration Manager, which ended up being corrupt/missing WMI provider files.

There are lots of tedious ways to resolve this issues according to what I've read, but the tool from tweaking.com was able to remove and replace/repair my WMI (Windows Management Instrumentation) Provider files.

I used to do computer repair and overall the tweaking.com tool really impressed me, and it was suggested from one of the WMI error forum pages I went to.

After I fixed this issue I was able to connect to my SQL db, both locally and remotely.

Hope this helps someone.

查看更多
不再属于我。
4楼-- · 2019-01-01 09:09

Very simple solution

use (local)\InstanceName that's it.it worked for me.

查看更多
孤独总比滥情好
5楼-- · 2019-01-01 09:11

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

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

i ensured and did the above as well and I just want to share that the DOUBLE BACKSLASH

oBuilder.DataSource = "SPECIFICPCNAME\SQLEXPRESS";

Using a SINGLE BACKSLASH resulted into a build error i.e.: Error 1 Unrecognized escape sequence

I hope this helps the next guy - I've sacrificed dinner, midnight snack and NBA highlights time solving this (shame)

Thanks to [Tamizh venthan] ^_^

查看更多
宁负流年不负卿
6楼-- · 2019-01-01 09:13

i Just enabled TCP/IP,VIA,Named Pipes in Sql Server Configuration manager , My problem got solved refer this for more info Resolving Named Pipes Error 40

查看更多
不再属于我。
7楼-- · 2019-01-01 09:15

Open SQL Server Configuration Manager

  1. Select SQL Server Services from right.
  2. Find your server from right and go to its properties (with right click)
  3. Change log on method to Local System.

enter image description here

enter image description here

查看更多
登录 后发表回答