Introduction

I am now providing resolution of The underlying provider failed on open problem whenever we are working on across the network. If you see inner exception message then you'll caught in below error description in detail. This problem comes often when we are working with Entity Framework with MVC, ASP.Net, Windows Forms, WPF etc. This issue can be encountered in noticed scenarios. I've also written in detail associated with issue  Could not open a connection to SQL Server.

Error Description

{"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)"}



Step 1: Click (Windows + R) to run program quickly and type "dcomcnfg" then click OK button.

dcomcnfg


Step 2:Now you'll see Component Services screen, further expand it Distributed Transaction Coordinator.


Distributed Transaction Coordinator


Step 3: Next right click on Local DTC and click on Properties.


Local DTC



Step 4: Now you will see Local DTC Properties window and click on Security tab, under Transaction Manager Communication section tick option Allow Inbound and Allow Outbound and then finally click on OK button.

Transaction Manager Communication

if above Four steps does not work for you then I am throwing shade of my previous article on error Could not open a connection to SQL Server which explains step by step with great description, I am listing main steps here also.

  1. Check for SQL Server (MSSQLSERVER) service whether it's running or
  2. Check for SQL Server Browser service to running fine.
  3. Check for Aliases.
  4. Check for SQL Server Default Port 1433 is existing or not.
  5. Check for Allow remote connections to this server.
  6. Ping for your IP Host Address whether it is responding or not.
  7. You can check for Windows log detail tying in quick window EVENTVWR to investigate into issue very closely.

Observations

No 1: Server Machine While in Sleep Mode

Sometimes, The underlying provider failed on open also happens when your machine/server goes into sleep mode, so avoid your machine/server not switch to sleeping mode.

No 2: Low Internet Accessibility

This week , I faced a new scenario because Internet accessibility was very low and server was sending timeout due to low internet accessibility, it was throwing error The underlying provider failed on open, this error comes in so many different ways whenever using Entity Framework in our application.

Summary

I have provided above two approaches to resolve the error The underlying provider failed on open, if you still doesn't resolve this issue, you can write your error with detail so can help you accordingly.

Suggested Reading