使用 .NET 4.5 連接到 SQL Server Azure 時發生握手異常
所以我打開了一些大約2個月沒有動過的程式碼。
上次我打開應用程序時,所有單元測試都通過了。現在沒有程式碼更改,我的所有數據單元測試都失敗並出現以下錯誤:
初始化方法 PerTrac.Pictor.Data.Test.RequestLogRepositoryShould.CreateLog 拋出異常。System.Data.EntityException:System.Data.EntityException:基礎提供程序在打開時失敗。—> System.Data.SqlClient.SqlException: 與伺服器建立連接成功,但在登錄前握手過程中發生錯誤。(提供者:SSL 提供者,錯誤:0 - 等待操作超時。)—> System.ComponentModel.Win32Exception:等待操作超時。
我意識到存在與此類似的問題,但這些解決方案對我的情況沒有任何影響。
有沒有人特別遇到過實體框架和 SQL Azure 的這個錯誤?
我應該注意,我可以使用相同的憑據毫無問題地從 SSMS 連接。我沒有在禁用協議上設置強制加密,並且我已經多次重置本地 IIS。
很可能您的電腦上安裝了一些應用程序,該應用程序使用已棄用的網路協議來攔截網路流量。正確的解決方案是禁用或解除安裝這些應用程序。
執行命令行命令netsh WinSock Show Catalog >> winsock.txt然後記事本winsock.txt打開文件。
查看返回的每個Winsock 目錄提供程序條目。如果服務標誌值設置了 0x20000 位,則提供程序使用 IFS 句柄並且可以正常工作。如果“服務標誌”0x20000 位被清除(未設置),則它是非 IFS BSP 或 LSP,可能是一個問題。嘗試禁用此應用程序並讓我們知道它是否有效。
查看文本文件結果時,請忽略“名稱空間提供者條目”。他們不是問題。
下面是 netsh WinSock Show Catalog 文件輸出的干淨系統的樣例。
Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: MSAFD Tcpip [TCP/IP] Provider ID: {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1001 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 1 Protocol: 6 Service Flags: 0x20066 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: MSAFD Tcpip [UDP/IP] Provider ID: {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1002 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 2 Protocol: 17 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: MSAFD Tcpip [RAW/IP] Provider ID: {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1003 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 3 Protocol: 0 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: MSAFD Tcpip [TCP/IPv6] Provider ID: {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1004 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 1 Protocol: 6 Service Flags: 0x20066 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: MSAFD Tcpip [UDP/IPv6] Provider ID: {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1005 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 2 Protocol: 17 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: MSAFD Tcpip [RAW/IPv6] Provider ID: {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1006 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 3 Protocol: 0 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: RSVP TCPv6 Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1007 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 1 Protocol: 6 Service Flags: 0x22066 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: RSVP TCP Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1008 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 1 Protocol: 6 Service Flags: 0x22066 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: RSVP UDPv6 Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1009 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 2 Protocol: 17 Service Flags: 0x22609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider Description: RSVP UDP Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1010 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 2 Protocol: 17 Service Flags: 0x22609 Protocol Chain Length: 1 Winsock 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.dll Catalog Entry ID: 1001 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 1 Protocol: 6 Service Flags: 0x20066 Protocol Chain Length: 1 Winsock 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.dll Catalog Entry ID: 1002 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 2 Protocol: 17 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock 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.dll Catalog Entry ID: 1003 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 3 Protocol: 0 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock 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.dll Catalog Entry ID: 1004 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 1 Protocol: 6 Service Flags: 0x20066 Protocol Chain Length: 1 Winsock 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.dll Catalog Entry ID: 1005 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 2 Protocol: 17 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock 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.dll Catalog Entry ID: 1006 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 3 Protocol: 0 Service Flags: 0x20609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider (32) Description: RSVP TCPv6 Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1007 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 1 Protocol: 6 Service Flags: 0x22066 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider (32) Description: RSVP TCP Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1008 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 1 Protocol: 6 Service Flags: 0x22066 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider (32) Description: RSVP UDPv6 Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1009 Version: 2 Address Family: 23 Max Address Length: 28 Min Address Length: 28 Socket Type: 2 Protocol: 17 Service Flags: 0x22609 Protocol Chain Length: 1 Winsock Catalog Provider Entry ------------------------------------------------------ Entry Type: Base Service Provider (32) Description: RSVP UDP Service Provider Provider ID: {9D60A9E0-337A-11D0-BD88-0000C082E69A} Provider Path: %SystemRoot%\system32\mswsock.dll Catalog Entry ID: 1010 Version: 2 Address Family: 2 Max Address Length: 16 Min Address Length: 16 Socket Type: 2 Protocol: 17 Service Flags: 0x22609 Protocol Chain Length: 1 Name Space Provider Entry ------------------------------------------------------ Description: Network Location Awareness Legacy (NLAv1) Namespace Provider ID: {6642243A-3BA8-4AA6-BAA5-2E0BD71FDD83} Name Space: 15 Active: 1 Version: 0 Name Space Provider Entry ------------------------------------------------------ Description: E-mail Naming Shim Provider Provider ID: {964ACBA2-B2BC-40EB-8C6A-A6DB40161CAE} Name Space: 37 Active: 1 Version: 0 Name Space Provider Entry ------------------------------------------------------ Description: PNRP Cloud Namespace Provider Provider ID: {03FE89CE-766D-4976-B9C1-BB9BC42C7B4D} Name Space: 39 Active: 1 Version: 0 Name Space Provider Entry ------------------------------------------------------ Description: PNRP Name Namespace Provider Provider ID: {03FE89CD-766D-4976-B9C1-BB9BC42C7B4D} Name Space: 38 Active: 1 Version: 0 Name Space Provider Entry ------------------------------------------------------ Description: Tcpip Provider ID: {22059D40-7E9E-11CF-AE5A-00AA00A7112B} Name Space: 12 Active: 1 Version: 0 Name Space Provider Entry ------------------------------------------------------ Description: NTDS Provider ID: {3B2637EE-E580-11CF-A555-00C04FD8D4AC} Name Space: 32 Active: 1 Version: 0 Name Space Provider Entry ------------------------------------------------------ Description: WindowsLive NSP Provider ID: {4177DDE9-6028-479E-B7B7-03591A63FF3A} Name Space: 12 Active: 1 Version: 1 Name Space Provider Entry ------------------------------------------------------ Description: WindowsLive Local NSP Provider ID: {229F2A2C-5F18-4A06-8F89-3A372170624D} Name Space: 19 Active: 1 Version: 1 Name Space Provider Entry (32) ------------------------------------------------------ Description: Network Location Awareness Legacy (NLAv1) Namespace Provider ID: {6642243A-3BA8-4AA6-BAA5-2E0BD71FDD83} Name Space: 15 Active: 1 Version: 0 Name Space Provider Entry (32) ------------------------------------------------------ Description: E-mail Naming Shim Provider Provider ID: {964ACBA2-B2BC-40EB-8C6A-A6DB40161CAE} Name Space: 37 Active: 1 Version: 0 Name Space Provider Entry (32) ------------------------------------------------------ Description: PNRP Cloud Namespace Provider Provider ID: {03FE89CE-766D-4976-B9C1-BB9BC42C7B4D} Name Space: 39 Active: 1 Version: 0 Name Space Provider Entry (32) ------------------------------------------------------ Description: PNRP Name Namespace Provider Provider ID: {03FE89CD-766D-4976-B9C1-BB9BC42C7B4D} Name Space: 38 Active: 1 Version: 0 Name Space Provider Entry (32) ------------------------------------------------------ Description: Tcpip Provider ID: {22059D40-7E9E-11CF-AE5A-00AA00A7112B} Name Space: 12 Active: 1 Version: 0 Name Space Provider Entry (32) ------------------------------------------------------ Description: NTDS Provider ID: {3B2637EE-E580-11CF-A555-00C04FD8D4AC} Name Space: 32 Active: 1 Version: 0 Name Space Provider Entry (32) ------------------------------------------------------ Description: WindowsLive NSP Provider ID: {4177DDE9-6028-479E-B7B7-03591A63FF3A} Name Space: 12 Active: 1 Version: 1 Name Space Provider Entry (32) ------------------------------------------------------ Description: WindowsLive Local NSP Provider ID: {229F2A2C-5F18-4A06-8F89-3A372170624D} Name Space: 19 Active: 1 Version: 1