当我尝試从本地環境連線生产資料庫時,出現以下錯誤。
我以前可以連線生产資料庫,但是突然我收到以下錯誤提示,知道吗?
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The handle is invalid.)
我試圖在本地PC上執行asp.net網站,该網站具有生产資料庫的連線字元串,以下是我在本地環境中遇到的錯誤的堆棧跟蹤。
at MyWebsiteDAL.clsForumQuestion.SelectAll(Int32 CurrentPageIndex, Int32 PageSize) in D:\EDrive\My WebSites\MyWebsite\MyWebsite\MyWebsiteDAL\clsForumQuestion.cs:line 821 at CodeConnect.Default.Page_Load(Object sender, EventArgs e) in D:\EDrive\My WebSites\MyWebsite\MyWebsite\MyWebsite\Default.aspx.cs:line 100 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
您知道這裏可能出了什麼問题吗?
- 5月前1 #
- 5月前2 #
- Save your work,
- Close Visual Studio, then
- Re-open your project始终為我工作。
- 5月前3 #
在執行一些記憶體非常昂贵的程序時,我遇到了此錯誤.当系統開始記憶體不足時,我開始註意到這種錯誤。 為了更好地利用RAM,我不得不更改演算法。
要註意的是,尽管有些執行緒丟擲了该異常,但其他執行緒丟擲了:
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=43606; handshake=560; --->System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
更改系統後,两个問题都消失了,因此可以使用更少的RAM来執行。
- 5月前4 #
執行以下命令對我有用:
netsh Winsock reset
见https://serverfault.com/a/487139/250527
- 5月前5 #
您可能要檢查几件事:
您的生产服務器允许遠端連線. (可能有人將其關闭,尤其是如果您有DBA)
檢查您的連線字元串.有時,如果您使用的是IP地址或服務器名稱,則会匯致此錯誤.尝試两者。
相似問題
- regex:SQL Server服務器中的正則表達式?sqlserverregexsqlserver2005sqlserver2008sqlserver20002021-01-11 22:56
- sql:如何防止資料庫觸發器遞迴?sqlsqlservertsqlsqlserver2008triggers2021-01-11 17:24
- sql server:多列的唯一約束sqlserversqlserver2008ssms2021-01-10 04:57
Solution
1)簡潔VS.Net解決方案
2)重建專案。
3)重置IIS
4)再次執行專案。
基本上可以解決我的問题,但就我而言,我没有遇到此錯誤,突然我的本地環境開始给我上述錯誤,所以這可能對我来說是个窍門。