在我的應用程序中,我使用RestSharp來查詢REST API和System.Net.Mail來發送電子郵件。在程序啓動時,我設置了ServicePointManager.SecurityProtocol屬性。ServicePointManager SecurityProtocol衝突
如果我將該屬性設置爲:
The request was aborted: Could not create SSL/TLS secure channel
如果我將該屬性設置爲:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls11;
例外是
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
異常與RestSharp查詢API時拋出與System.Net.Mail發送電子郵件時拋出:
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm
我應該如何解決這個問題?
什麼版本的.NET?如果你不是最新的,是否有可能升級?之後,我會嘗試縮小一點。使用chrome插件郵差嘗試與您的API進行通信。設置Fiddler(或wireshark)攔截流量並查看數據包以查看它正在嘗試協商的內容。你也只是使用標準的SmtpClient類?你的代碼是什麼樣的使用它? – Wjdavis5
您可以在撥打電話之前爲服務點管理員設置正確的值。 –