Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection Timeout Expired. The timeout period elapsed during the post-login phase

In my application, queries are working fine. For a single select query, i am getting below error.

System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=0; handshake=13914; [Login] initialization=0; authentication=0; [Post-Login] complete=1062; ---> System.ComponentModel.Win32Exception: The wait operation timed out

I have ran sqlprofiler for detecting deadlocks but found none.

I am running simple query through entity framework

Any help would be appreciated

like image 785
Keshav Prashant Avatar asked Aug 20 '14 17:08

Keshav Prashant


People also ask

How do I fix the connection timeout expired in SQL Server?

If you encounter a connection-timeout error, follow the steps: Increase the connection-timeout parameter. If you use an application to connect to SQL Server, increase the relevant connection-timeout parameter values and check whether the connection eventually succeeds.

How do I change timeout in SQL Server?

Using SQL Server Management StudioIn Object Explorer, right-click a server and select Properties. Click the Connections node. Under Remote server connections, in the Remote query timeout box, type or select a value from 0 through 2,147,483,647 to set the maximum number seconds for SQL Server to wait before timing out.


2 Answers

Here in stack overflow, there is a post called Help troubleshooting SqlException: Timeout expired on connection, in a non-load situation. It is a problem very similar to your problem. Please take a look.

I will quote (from that post) a comment as a possible cause of your problem:

"Not Enough Memory"

"You may have 'Auto Close' enabled"

"SQL Agent Jobs may be causing problems"

In that post you can see a very good explanation about the topic.

like image 173
Orlando Herrera Avatar answered Sep 30 '22 05:09

Orlando Herrera


Maybe you forgot to .Close your connection before.

that's why: Or it could have timed out while attempting to create multiple active connections.

(I cant comment for now due to my reputation, dont take this as a full answer)

like image 27
Touk Avatar answered Sep 30 '22 06:09

Touk