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

Did have the same problem. Spent like 6 hours when had to migrate some servers. Tried all suggestions available on this topic and others.

Solution was as simple as server restart!

查看更多
何处买醉
3楼-- · 2019-01-01 09:21

I had the same problem. I use the MSSQL Server Management Studio 2017 and solved this problem using these steps:

  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. Restart SQL Server (MSSQLSERVER)

and fixed it.

查看更多
旧时光的记忆
4楼-- · 2019-01-01 09:22

Thanks to Damian...

TCP/IP Named Pipes ... both enabled

Web Config....(for localhost)

<add name="FooData" connectionString="Data Source=localhost\InstanceName;Initial Catalog=DatabaseName;Integrated Security=True;" providerName="System.Data.SqlClient" />
查看更多
登录 后发表回答