sql-server-2012 - .NET 4.5 表单应用程序连接到 SQL Server 2012 失败 : SSL Provider, 错误:0

标签 sql-server-2012 .net-4.5 c#-5.0

我与在 Windows Server 2012 上运行的 SQL Server 2012 实例的连接出现问题。我在运行 Windows 7 的客户端计算机上安装了一个 .NET 4.5 Windows 窗体应用程序。我得到的错误是:

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 中我能想到的所有设置。协议(protocol)(共享内存和 tcp/ip)上未启用强制加密,服务器上的域防火墙已打开。我尝试了各种带有各种闻所未闻参数的连接字符串,结果总是相同,失败。

我真的很困惑为什么它可以与 QueryExpress 一起使用?我的应用程序在连接到另一台机器上的 SQL SERVER Express 远程实例时可以工作,如果我在 SQL Server 2012 机器上运行它也可以工作。

我还尝试使用 LinqPad 从客户端计算机连接到服务器。这也很奇怪,基于net4/4.5(版本:4.43.06)的新版本失败了,但是当我使用基于net3.5的旧版本的Linqpad(2.x)时它可以工作!

似乎是 Panda Security 引起了问题,我跑了
netsh winsock show catalog 

并找到了一些 Pandas 条目,然后我进行了重置
netsh winsock reset

现在我的应用程序工作正常,然后我重新启动机器,再次运行目录命令,
Pandas 条目又回来了,我的应用程序遇到了和以前一样的问题。

以下是 winsock 目录中的 Panda 条目:https://gist.github.com/pellehenriksson/5159883

感谢所有想法和建议。

更新

Panda Security v5 是导致此问题的原因,这已由 Panda 支持部门确认。
下面的 Alex 解释了问题的根本原因。客户将升级到 Pandas 安全v6,升级后我会再次测试。

结论
迁移到 Panda Security v6.0 解决了这个问题。

最佳答案

这似乎是与 Microsoft 无关的问题:Visual Studio 11 beta installation disabled my abillity to connect remote MS SQL Server but not local databases .

票已经作为外部关闭 .

目前在 Microsoft Connect 上可用的唯一解决方法是:

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.



因此,您应该删除 Panda Security,或者,您可以尝试执行 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.

关于sql-server-2012 - .NET 4.5 表单应用程序连接到 SQL Server 2012 失败 : SSL Provider, 错误:0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15393398/

相关文章:

sql-server - 无法在 SSMS 中查看 GEOGRAPHY(空间结果选项卡)

sql-server-2012 - 在 nvarchar(max) 列上创建索引

sql - 如何从 SQL Server 中的特定行开始行号

vb.net - 将多部分表单发布到 Bamboo API

timezone - MVC 处理时区和 JSON 序列化 - 如何转换为特定时区

c# - C#中的冒号参数,冒号代表什么

c# - 在捕获 block 中等待

sql - 我是否需要在外键上指定 ON DELETE NO ACTION?

.net-4.5 - 异步 - 留在当前线程上?

c# - 获取异步方法的结果