2015-01-15 26 views
0

我在嘗試打開與SQL Server 2005的連接時出現以下錯誤。我正在使用.Net SqlConnection類,並且在發生錯誤時引發open()叫做。我的代碼可以從本地機器正常運行,但會從我們的測試服務器中引發錯誤。測試服務器正在運行IIS 6.0。sql server 2005連接打開錯誤 - 現有連接被遠程主機強制關閉

錯誤:

System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open()
at Portal.Data.SqlDataAccess..ctor(String ConString) in...

我使用的連接字符串

Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dbname;Data Source=servername;Packet Size=4096" providerName="System.Data.SqlClient" 

感謝

回答

0

這裏是一個website解釋連接字符串,它是一個生命的救星。但是對於「集成安全= SSPI」,它試圖以運行二進制文件的用戶的身份連接到服務器。如果用戶沒有權限分貝,然後繁榮。這是10次中的9次。

+0

感謝(該服務器,而不是客戶端上的日誌)。我檢查了權限,並且用戶有權訪問數據庫。 – vabii 2015-01-16 19:19:50

+0

數據庫和測試服務器是同一臺機器嗎?你在測試機器上有SSMS來測試連接嗎?它可能是Windows防火牆或防病毒停止連接。從測試機器上,你可以ping數據庫機器? – Dbloch 2015-01-16 19:23:26

+0

數據庫和IIS(測試服務器)位於不同的機器上。測試服務器上沒有SSMS。我能夠從測試服務器ping到數據庫服務器。我試圖從測試服務器創建一個dsn,但它失敗了。來自測試服務器的 – vabii 2015-01-16 21:07:26

0

這是一個老問題,但是從舊計算機連接到新的服務器時,我最近遇到了同樣的錯誤消息。它發生在嘗試建立連接時,並返回錯誤消息:

[Microsoft][SQL Server Native Client 10.0]TCP Provider: An existing connection was forcibly closed by the remote host.

與SQL Server錯誤:10054。在服務器上的Windows系統日誌中我發現了一個錯誤(來源= Schannel):

An TLS 1.0 connection request was received from a remote client application, but none of the cipher suites supported by the client application are supported by the server. The TLS connection request has failed.

我們基本上放棄了舊的TLS協議時,我們升級了服務器,但較舊的計算機沒有足夠的更現代的協議。這是Windows版本限制。

在任何情況下,誰擁有了類似的問題,首先檢查你的防火牆日誌其他人,那麼你的SQL Server日誌,其中還包括(在管理樹)在SSMS Windows日誌。

相關問題