ADO.Net can sometimes connect to another server on the local network. It seems random whether this connection attempt is successful or unsuccessful. A connection uses a connection string in the form:
Server = THESERVER \ TheInstance; Database = TheDatabase; User ID = TheUser; Password = ThePassword;
returned error:
Connection timed out. The timeout period has expired while trying to use an acknowledgment confirmation before entering the system.
This may be due to the fact that the handshake before entering the system failed or the server was unable to respond on time.
The duration spent trying to connect to this server was - [Pre-Login] initialization = 42030; acknowledgment = 0;
The .NET application is a small test application that runs the following code:
using (SqlConnection conn = new SqlConnection(cs)) using (SqlCommand cmd = new SqlCommand("SELECT COUNT(*) FROM TheTable", conn)) { conn.Open(); int rowCount = (int)cmd.ExecuteScalar(); }
TheTable is small, only 78 lines.
However, on the same machine where the .NET application receives this error, I can connect to THESERVER using SSMS and the User Id / Password named in the connection string.
Why can the connection be disconnected from the ADO.Net application, but using the same credentials from SSMS?
Eric J. Mar 18 '13 at 23:34 2013-03-18 23:34
source share