“因為算法不同,客戶端與服務器無法通信。”的解決方法


 

先說明我的環境,站點和數據庫是分開部署的。

站點服務器:windows server 2016、.net framework 4.6.1

數據庫服務器:windows server 2016、sql server 2008 R2

 

根據網上的帖子,設置了如下代碼也不起效果

(具體原因可以看這篇討論帖:https://stackoverflow.com/questions/26742054/the-client-and-server-cannot-communicate-because-they-do-not-possess-a-common-a

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

// 或者

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

 

最后根據微軟文檔的說明,改動注冊表就成功了:https://docs.microsoft.com/zh-cn/windows-server/security/tls/tls-registry-settings

具體我的做法是:

1、把幾個“SSL”的關閉掉,就是把它的“Enabled”設置為0。

2、把幾個“TLS”的“DisabledByDefault”設置為0,“Enabled”設置為1,Client和Server都要這樣設置。

3、兩台服務器的設置一致,然后需要重啟電腦才可生效。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM