Search code examples
sql-serversql-server-2005linked-serverdatabase-connectivity

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


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?


Solution

  • 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