2013-03-13 71 views
8

我與運行在Windows Server 2012上的SQL Server 2012實例有連接問題。我安裝了.NET 4.5 Windows窗體應用程序運行Windows 7我得到的錯誤客戶端機器是這樣的:連接到SQL Server 2012的.NET 4.5窗體應用程序失敗:SSL提供程序,錯誤:0

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.) 

我的連接字符串看起來是這樣的:

server=SERVERNAME;database=DATABASENAME;User Id=someuser;password=somepassword;Timeout=60;app=LabelMaker 

使用QueryExpress 我試圖連接到SQL Server的客戶機和成功了!如果有任何幫助,我的應用程序是64位的。我檢查了我在SQL Server中可以想到的所有設置。協議上沒有強制加密(共享內存和tcp/ip),域防火牆在服務器上打開。我已經嘗試過各種連接字符串和各種未聽到的關閉參數,總是相同的結果,失敗。

我很困惑它爲什麼與QueryExpress一起工作?我的應用程序在連接到另一臺機器上的SQL SERVER Express的遠程實例時工作,如果我在SQL Server 2012計算機上運行它,它也可以工作。

我也嘗試從LinqPad與客戶機連接到服務器,這也很奇怪,與基於net4/4.5(版本:4.43.06)的新版本,它失敗了,但當我使用舊基於net3.5的Linqpad(2.x)版本的工作原理!

好像熊貓安全原因造成的問題,我跑

netsh winsock show catalog 

,並發現了一些熊貓的條目,然後我做了復位

netsh winsock reset 

現在我的應用程序工作正常,我那麼重新啓動機器,再次運行目錄命令, 熊貓條目回來了,我的應用程序遇到了和以前一樣的問題。

下面是Winsock目錄中的條目熊貓:https://gist.github.com/pellehenriksson/5159883

所有的意見和建議表示讚賞。

UPDATE

熊貓安全V5是這個問題的原因,這已被熊貓的支持證實。 下面的Alex解釋了問題的根本原因。客戶將升級到熊貓安全v6,升級後我會再次測試。

結論 搬到熊貓安全v6.0修復了這個問題。

+0

看起來像防火牆問題。閱讀以下主題:[將Windows防火牆配置爲允許SQL Server訪問](http://technet.microsoft.com/zh-cn/library/cc646023.aspx)。您的應用程序是否連接到數據庫引擎/分析服務/報告? – 2013-03-14 08:29:42

+0

我很確定這不是一個防火牆問題,我可以連接用.NET 2.0編寫的客戶端。當刪除Panda LSP時,它也適用於.NET 4.5。 – Pelle 2013-03-14 08:36:51

+0

你也可以添加連接字符串嗎? – 2013-03-14 08:39:30

回答

6

這似乎是一個非微軟相關問題:Visual Studio 11 beta installation disabled my abillity to connect remote MS SQL Server but not local databases

機票已被關閉爲外部

唯一可在這個時候對微軟連接的解決方法是:

Posted by Lars Joakim Nilsson on 5/4/2012 at 5:03 AM

My machine had this problem. The work around for me was to remove non-IFS LSP installed Winsock Catalog Provider. Se http://support.microsoft.com/kb/2568167 /Lars Nilsson

SetFileCompletionNotificationModes API causes an IO completion port not work correctly with a non-IFS LSP installed鏈接給分辨率:

Not specifying the FILE_SKIP_COMPLETION_PORT_ON_SUCCESS flag or removing any non-IFS Winsock LSPs installed. Also moving from a non-IFS LSP to Windows Filter Platform (WFP) can resolve this issue.

所以,你應該刪除熊貓安全,或者作爲替代,您可以嘗試執行netsh winsock reset作爲預生成命令 (雖然我不確定這是否有效,但不重新啓動) ,它可以讓您開發/調試您的應用程序。

[更新]

有關應用程序兼容性

更多的信息在這裏給出:Application Compatibility in the .NET Framework 4.5

Data

SQLClient

Feature

Ability to connect to a SQL Server database from managed code that runs under the .NET Framework 4.5.

Change

The existing synchronous API code path was modified to add asynchronous support.

Impact

The presence of non-IFS Winsock Base Service Providers (BSPs) or Layered Service Providers (LSPs) may interfere with the ability to connect to SQL Server. For more information, see SetFileCompletionNotificationModes API causes an IO completion port not work correctly with a non-IFS LSP installed on the Microsoft Support website.

+1

只要我不重新啓動機器,實際上只要重新啓動就行。 =)問題不在我的機器上。這是客戶客戶機上的問題。我猜想研究熊貓安全是下一步。感謝您的幫助。 – Pelle 2013-03-14 09:04:45

2

我討厭這樣說,但在重新啓動Visual Studio和我的Microsoft SQL Server Management Studio中解決了這個問題。

+0

它沒有任何意義,但你的解決方案工作! – 2015-05-26 16:36:32

+0

SSMS如何導致這個錯誤令人困惑,但它的工作原理! – 2015-10-13 01:29:50

相關問題