2013-03-13 68 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

相关问题