Navigation

The underlying provider failed on open

The underlying provider failed on open, Could not open a connection to SQL Server, error: 40, sql server error 53

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

Share

Anjan Kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment:

6 comments:

  1. Thanks for this Introduction ı have solved my problem

    ReplyDelete
    Replies
    1. It is good to know that it resolved your problem.

      Delete
  2. You can fix that issue setting identity in application pool to use you user.

    ReplyDelete
    Replies
    1. This is why, IIS is attempting to access db, so you can check your database user is allowed to connect or not.

      Delete
  3. Hey, there! Thanks for your article. I'm working on a mobile app which makes a lot of transactions with the database through Web API, when you load the app or login it synchronizes all data from an to the server. The problem is that, because it makes a lot of requests, especially having in mind that after each item is synchronized the last update date is changed at the server, and there is an authentication filter, maybe the database can't handle all of that stuff easily. Since the database is in an external server and I don't have easy access to the machine configuration, I want to ask first: do you think that doing the Local DTC change will help me?

    Thanks a lot!

    ReplyDelete
    Replies
    1. @David you need to provide necessary privileges of your database user to access database remotely. It is more comfortable whenever your both application and db is lying on the same server.

      Delete