2017-03-01 29 views
1

我正在开发一个向Trello网站发出REST请求的.net核心应用程序。但是,在第一次请求时,我得到了一个TlsException: Invalid certificate received from server的提出。如何验证从.net核心应用程序中的网站收到的证书

谷歌搜索此错误后,我找到了一种解决方法,使用ServicePointManager.ServerCertificateValidationCallback方法。我的问题是,ServicePointManager不是.net核心的一部分。验证Trello证书的正确方法是什么?或者在我的环境中完全绕过验证步骤?

下面是相关异常堆栈跟踪:

TlsException: Invalid certificate received from server. Error code: 0xffffffff80092012 
Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) 
Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1() 
Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process() 
(wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process() 
Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) 
Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) 
Rethrow as IOException: The authentication or decryption has failed. 
Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) 
Rethrow as WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure 
System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) 
System.Net.HttpWebRequest.GetResponse() 
RestSharp.Http.GetRawResponse (System.Net.HttpWebRequest request) 
Rethrow as WebException: Trello returned with an error. 
Error Message: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure 

回答

相关问题