这段代码在Unity 2017.4.15f1中引发了TlsException,我看过其他问题,但似乎没有解决方案。我模糊地理解这是一个与证书有关的问题(?)
private void Start()
{
var client = new WebClient();
var text = client.DownloadString("https://jsonplaceholder.typicode.com/posts/1");
Debug.Log(text);
}
// --- ERROR THROWN
TlsException: The authentication or decryption has failed.
Mono.Security.Protocol.Tls.RecordProtocol.ProcessAlert (AlertLevel
alertLevel, AlertDescription alertDesc)
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 ()
System.Net.WebClient.GetWebResponse (System.Net.WebRequest request)
System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken)