Blog Post

Additional information: The underlying provider failed on Open.

Wednesday, June 15, 2016 1:14 PM

While working on my personal project I have come across exception from EF

Additional information: The underlying provider failed on Open.

I have decided to write a blog post about solution of this error as I have believed that I have resolved it long time ago (at least I did not experienced it after).

This is not my first project where I have come across this error and I will be not for last time.

 

I am using EF (Entity Framework).

 

Digging deeper into the exception:

{"Connection Timeout Expired.  The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.  This could be because the pre-login handshake failed or the server was unable to respond back in time.  The duration spent while attempting to connect to this server was - [Pre-Login] initialization=897; handshake=12; "}

Now to resolve this issue I have decided that I needed to modify connection string to update timeout to little bit longer

 My original connection string 

Data Source=192.168.1.1;Initial Catalog=TestDB;Trusted_Connection=true;Asynchronous Processing=true

So into my connection string I have added

;Connection Timeout=180

so the final connection string

Data Source=192.168.1.1;Initial Catalog=TestDB;Trusted_Connection=true;Asynchronous Processing=true;Connection Timeout=180

note:

 180 is value in seconds. You might want to update your connection string to something more reasonable.

And this has resolved my issue