RestSharp - 忽略 SSL 错误 [英] RestSharp - Ignore SSL errors
本文介绍了RestSharp - 忽略 SSL 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么办法可以让 RestSharp 忽略 SSL 证书中的错误?我有一个测试客户端,而我连接的服务还没有有效的证书.
Is there any whay that I can get RestSharp to ignore errors in SSL certificates? I have a test client, and the service I connect to does not yet have a valid cetificate.
当我现在提出请求时出现错误:
When I make a request now I get the error:
The underlying connection was closed: Could not establish trust
relationship for the SSL/TLS secure channel.
推荐答案
正如 John 所建议的:
As John suggested:
ServicePointManager.ServerCertificateValidationCallback +=
(sender, certificate, chain, sslPolicyErrors) => true;
这篇关于RestSharp - 忽略 SSL 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文