Handshake exception occurring when connecting to SQL Server Azure with .NET 4.5 Handshake exception occurring when connecting to SQL Server Azure with .NET 4.5 azure azure

Handshake exception occurring when connecting to SQL Server Azure with .NET 4.5


Most likely you have some application installed on your computer that is using deprecated network protocols to intercept network traffic. The correct solution is hopefully to disable or uninstall those applications.

Run the command line command netsh WinSock Show Catalog >> winsock.txt and then notepad winsock.txt to open the file.

Look at every Winsock Catalog Provider Entry returned. If the Service Flags value has the 0x20000 bit set then the provider uses IFS handles and will work fine. If the “Service Flags” 0x20000 bit is clear (not set), then it is a non-IFS BSP or LSP and could be an issue. Try disabling this application and let us know if it then worked.

Ignore the “Name Space Provider Entry” when you are looking at the text file results. They aren't the problem.

Below is a sample of what my clean system looks like for the output of the netsh WinSock Show Catalog file.

Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        MSAFD Tcpip [TCP/IP]Provider ID:                        {E70F1AA0-AB8B-11CF-8CA3-00805F48A192}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1001Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        1Protocol:                           6Service Flags:                      0x20066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        MSAFD Tcpip [UDP/IP]Provider ID:                        {E70F1AA0-AB8B-11CF-8CA3-00805F48A192}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1002Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        2Protocol:                           17Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        MSAFD Tcpip [RAW/IP]Provider ID:                        {E70F1AA0-AB8B-11CF-8CA3-00805F48A192}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1003Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        3Protocol:                           0Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        MSAFD Tcpip [TCP/IPv6]Provider ID:                        {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1004Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        1Protocol:                           6Service Flags:                      0x20066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        MSAFD Tcpip [UDP/IPv6]Provider ID:                        {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1005Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        2Protocol:                           17Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        MSAFD Tcpip [RAW/IPv6]Provider ID:                        {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1006Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        3Protocol:                           0Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        RSVP TCPv6 Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1007Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        1Protocol:                           6Service Flags:                      0x22066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        RSVP TCP Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1008Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        1Protocol:                           6Service Flags:                      0x22066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        RSVP UDPv6 Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1009Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        2Protocol:                           17Service Flags:                      0x22609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service ProviderDescription:                        RSVP UDP Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1010Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        2Protocol:                           17Service Flags:                      0x22609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        MSAFD Tcpip [TCP/IP]Provider ID:                        {E70F1AA0-AB8B-11CF-8CA3-00805F48A192}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1001Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        1Protocol:                           6Service Flags:                      0x20066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        MSAFD Tcpip [UDP/IP]Provider ID:                        {E70F1AA0-AB8B-11CF-8CA3-00805F48A192}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1002Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        2Protocol:                           17Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        MSAFD Tcpip [RAW/IP]Provider ID:                        {E70F1AA0-AB8B-11CF-8CA3-00805F48A192}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1003Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        3Protocol:                           0Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        MSAFD Tcpip [TCP/IPv6]Provider ID:                        {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1004Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        1Protocol:                           6Service Flags:                      0x20066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        MSAFD Tcpip [UDP/IPv6]Provider ID:                        {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1005Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        2Protocol:                           17Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        MSAFD Tcpip [RAW/IPv6]Provider ID:                        {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1006Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        3Protocol:                           0Service Flags:                      0x20609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        RSVP TCPv6 Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1007Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        1Protocol:                           6Service Flags:                      0x22066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        RSVP TCP Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1008Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        1Protocol:                           6Service Flags:                      0x22066Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        RSVP UDPv6 Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1009Version:                            2Address Family:                     23Max Address Length:                 28Min Address Length:                 28Socket Type:                        2Protocol:                           17Service Flags:                      0x22609Protocol Chain Length:              1Winsock Catalog Provider Entry------------------------------------------------------Entry Type:                         Base Service Provider (32)Description:                        RSVP UDP Service ProviderProvider ID:                        {9D60A9E0-337A-11D0-BD88-0000C082E69A}Provider Path:                      %SystemRoot%\system32\mswsock.dllCatalog Entry ID:                   1010Version:                            2Address Family:                     2Max Address Length:                 16Min Address Length:                 16Socket Type:                        2Protocol:                           17Service Flags:                      0x22609Protocol Chain Length:              1Name Space Provider Entry------------------------------------------------------Description:                        Network Location Awareness Legacy (NLAv1) NamespaceProvider ID:                        {6642243A-3BA8-4AA6-BAA5-2E0BD71FDD83}Name Space:                         15Active:                             1Version:                            0Name Space Provider Entry------------------------------------------------------Description:                        E-mail Naming Shim ProviderProvider ID:                        {964ACBA2-B2BC-40EB-8C6A-A6DB40161CAE}Name Space:                         37Active:                             1Version:                            0Name Space Provider Entry------------------------------------------------------Description:                        PNRP Cloud Namespace ProviderProvider ID:                        {03FE89CE-766D-4976-B9C1-BB9BC42C7B4D}Name Space:                         39Active:                             1Version:                            0Name Space Provider Entry------------------------------------------------------Description:                        PNRP Name Namespace ProviderProvider ID:                        {03FE89CD-766D-4976-B9C1-BB9BC42C7B4D}Name Space:                         38Active:                             1Version:                            0Name Space Provider Entry------------------------------------------------------Description:                        TcpipProvider ID:                        {22059D40-7E9E-11CF-AE5A-00AA00A7112B}Name Space:                         12Active:                             1Version:                            0Name Space Provider Entry------------------------------------------------------Description:                        NTDSProvider ID:                        {3B2637EE-E580-11CF-A555-00C04FD8D4AC}Name Space:                         32Active:                             1Version:                            0Name Space Provider Entry------------------------------------------------------Description:                        WindowsLive NSPProvider ID:                        {4177DDE9-6028-479E-B7B7-03591A63FF3A}Name Space:                         12Active:                             1Version:                            1Name Space Provider Entry------------------------------------------------------Description:                        WindowsLive Local NSPProvider ID:                        {229F2A2C-5F18-4A06-8F89-3A372170624D}Name Space:                         19Active:                             1Version:                            1Name Space Provider Entry (32)------------------------------------------------------Description:                        Network Location Awareness Legacy (NLAv1) NamespaceProvider ID:                        {6642243A-3BA8-4AA6-BAA5-2E0BD71FDD83}Name Space:                         15Active:                             1Version:                            0Name Space Provider Entry (32)------------------------------------------------------Description:                        E-mail Naming Shim ProviderProvider ID:                        {964ACBA2-B2BC-40EB-8C6A-A6DB40161CAE}Name Space:                         37Active:                             1Version:                            0Name Space Provider Entry (32)------------------------------------------------------Description:                        PNRP Cloud Namespace ProviderProvider ID:                        {03FE89CE-766D-4976-B9C1-BB9BC42C7B4D}Name Space:                         39Active:                             1Version:                            0Name Space Provider Entry (32)------------------------------------------------------Description:                        PNRP Name Namespace ProviderProvider ID:                        {03FE89CD-766D-4976-B9C1-BB9BC42C7B4D}Name Space:                         38Active:                             1Version:                            0Name Space Provider Entry (32)------------------------------------------------------Description:                        TcpipProvider ID:                        {22059D40-7E9E-11CF-AE5A-00AA00A7112B}Name Space:                         12Active:                             1Version:                            0Name Space Provider Entry (32)------------------------------------------------------Description:                        NTDSProvider ID:                        {3B2637EE-E580-11CF-A555-00C04FD8D4AC}Name Space:                         32Active:                             1Version:                            0Name Space Provider Entry (32)------------------------------------------------------Description:                        WindowsLive NSPProvider ID:                        {4177DDE9-6028-479E-B7B7-03591A63FF3A}Name Space:                         12Active:                             1Version:                            1Name Space Provider Entry (32)------------------------------------------------------Description:                        WindowsLive Local NSPProvider ID:                        {229F2A2C-5F18-4A06-8F89-3A372170624D}Name Space:                         19Active:                             1Version:                            1


The key to understand the problem here is the provider and in your case it is "SSL Provider" and the main problem is that connection time out. If problem was related with "TCP Provider" there could be several reasons related with network etc however in your case it is a security related issue within the connection framework.

Next step to investigate this problem is that on the same machine, you can connect from SSMS to same SQL Database however not from IIS which means the IIS application process is not able to get proper certificate to create the SSL tunnel to create the successful connection. It is possible that you have some log written System Event log so please check there.

Because you are using Entity Framework and depend on EF version there are some changed in the connection string so verify if that is what you have:

<add name="MyDatabaseModelEntities" connectionString="metadata=res://*/MyDBModel.csdl|res://*/MyDatabaseModel.ssdl|res://*/MyDatabaseModel.msl;provider=System.Data.SqlClient;provider connection string="data source=abcdefg123.database.windows.net;initial catalog=MyDatabase;persist security info=True;user id=MyDatabaseUser@abcdefg123;password=p@$$w0rd;multipleactiveresultsets=True;Trusted_Connection=False;Encrypt=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> 

Finally if you are using EF 4.3.1 and connecting to SQL Database please have a look at this article and check if you have similar configuration.


This issue is reported in microsoft connect site here. Solution is availabel here. You need to remove non-IFS LSP installed Winsock Catalog Provider. Sometimes some software already installed on you machine may cause issue. In order to remove non-IFS LSP first run the following command on command prompt to see the application causing issue (ref)

netsh winsock show catalog > LSP.txt

see the output and analyze the application causing issue and uninstall it. hopefully it will resolve the issue.