Recently I found that connections were failing from one of our webservers to an MSSQL AlwaysOn Listener. The listener has two IP addresses because it spans subnets so we are specifying Multisubnetfailover=true in our connection string.
When attempting to make a connection to the listener I get the following error:
System.Data.SqlClient.SqlException (0x80131904): 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=20991; handshake=0; ---> System.ComponentModel.Win32Exception
(0x80004005): The wait operation timed out at
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32
waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions
userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1
retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,
TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection,
DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,
DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection,
DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at IRNXMLGateway.Controllers.IRNXMLGatewayController.GenericCall(String methodCall) in
CODELINE:line 376
ClientConnectionId:92074b33-176a-4006-b7c7-892e01a3eea7
I have also tried to connect using SSMS and ran into the same timeout issue.
I am able to successfully make connections by:
I am not experiencing this issue when attempting to connect from other servers. There are no errors in either the SQL or windows event logs to help determine the cause of the timeouts. Network trace shows the proper connection handshake with the current listener IP address. Neither servers have firewall or antivirus enabled. Webserver is running server 2008 web edition, SQL server is running windows server 2012 and sql server 2012.
So "I THINK" i was able to fix this. I re-installed .NET 4.5 and rebooted the server and now connections are made without issue. My current thought is that whoever installed 4.5 originally did not follow up with the required system reboot, leaving things in a weird state. I am going to continue to monitor this server for a few weeks to see if the problem re-occurs. I still appreciate any other opinions on what may have caused this.