.NET 4.5 forms app connecting to SQL Server 2012 fails: SSL Provider, error: 0

This seems to be a non-Microsoft related issue: Visual Studio 11 beta installation disabled my abillity to connect remote MS SQL Server but not local databases.

The ticket has been closed as external.

The only workaround available at this time on Microsoft Connect is:

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

The SetFileCompletionNotificationModes API causes an IO completion port not work correctly with a non-IFS LSP installed link gives the resolution:

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.

So, you should remove Panda Security or, as an alternative, you may try to execute netsh winsock reset as a pre-build command (although I'm not sure if this is effective without a reboot), which would let you develop/debug your application.

[UPDATE]

More information about application compatibility is given here: 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.


I hate to say it, but restarting Visual Studio and my Microsoft SQL Server Management Studio solved this problem.