gpt4 book ai didi

c# - 登录前握手期间发生错误

转载 作者:太空狗 更新时间:2023-10-30 01:18:32 24 4
gpt4 key购买 nike

经过几年的开发,我的 C#/.Net 程序在尝试连接到 MS Sql 服务器数据库时遇到了这个问题。我不知道如何修复它。它仅在尝试在特定表上写入时才会发生。清理该表后,我注意到这个问题的频率有所降低,但它仍然时不时地发生;

这是我得到的两个异常:

  1. System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.) ---> 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.Linq.DataQuery1.System.Linq.IQueryProvider.Execute[S](Expression >expression) at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable1 source)

2.

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=42511; handshake=6001; ---> 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) ...

最佳答案

我在过去两天由于安装 Windows 更新 KB2992611 而遇到了同样的错误,这是对 SChannel 的关键更新。我尚未确定这会破坏登录前握手的原因,但暂时卸载此更新可恢复连接到 SQL Server 的能力。

关于c# - 登录前握手期间发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26861787/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com