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.
提前致谢
/ michael
/michael
更新:
我最终使用:
ServicePointManager.ServerCertificateValidationCallback +=
(sender, certificate, chain, sslPolicyErrors) => true;
推荐答案
正如John所说:
ServicePointManager.ServerCertificateValidationCallback +=
(sender, certificate, chain, sslPolicyErrors) => true;
这篇关于RestSharp - 忽略SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文