我正在使用 SQL Server 2000 后端在 VS 2010 中开发 ASP.NET 应用程序(我知道,我知道......)
在过去 3 个月的大部分时间里,我一直使用此设置工作得很好。然而,昨天我确实应用了 VS 2010 SP1,现在连接到这个数据库导致以下错误:
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=72; handshake=44924
请记住,我没有对连接字符串或 SQL Server 2000 服务器/数据库进行任何更改。因此,自从新添加以来,它的发生一定是有原因的。
我的连接项目非常普通
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = sqlStatement;
SqlDataReader dr = cmd.ExecuteReader();
resultData.Load(dr);
dr.Close();
conn.Close();
我的连接字符串看起来像
Data Source=192.168.1.200;Persist Security Info=false;Initial Catalog=MyDB;User Id=MyUser;Password=MyPW;Timeout=45;
您可以看到我对超时进行了更改,但这没有用。但是,再一次,我不应该做任何改变。我昨天刚刚应用了 VS 2010 SP 1,这是唯一的变化。帮助!
最佳答案
我通过在服务器防火墙上打开端口 1433 (SQL) 来解决这个问题。
关于c# - SQL Server 2000 连接错误 - 登录前握手?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12308340/