12

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

kmatyaszek
  • 19,016
  • 9
  • 60
  • 65
Keshav Prashant
  • 121
  • 1
  • 1
  • 3
  • Strange, I'm getting the error from Azure SQL Server which should not be affected any lack of resource (RAM, CPU) what is advised in case of local machines (other host services). – Bronek Mar 30 '20 at 09:58

3 Answers3

6

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.

Community
  • 1
  • 1
Orlando Herrera
  • 3,481
  • 1
  • 34
  • 44
  • memory may be an issue because my application is running on Virtual machine but how to make sure this is the reason auto close is disabled SQL agent job are not running – Keshav Prashant Aug 20 '14 at 17:45
  • Try to add more memory to your VMachine. Did you read the post? They mentioned how to check the memory performance. – Orlando Herrera Aug 20 '14 at 18:05
1

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)

Touk
  • 459
  • 2
  • 14
0

This looks like a problem with the Active Directory. Maybe a port is blocked (for example 135), so a timeout occurred.

Razvan Socol
  • 5,426
  • 2
  • 20
  • 32