【问题标题】:Using an https:// asmx-based service with Monotouch将基于 https:// asmx 的服务与 Monotouch 一起使用
【发布时间】:2011-07-19 08:27:46
【问题描述】:

我正在尝试使用 ssl 添加对 asmx Web 服务的 Web 引用。我收到此错误: 获取响应流时出错:(写入:验证或解密失败。)SendFailure 我有自签名证书。

这个问题有解决办法吗?谢谢。

【问题讨论】:

  • 尝试将此添加到您的代码中: System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; };如果有帮助,您必须注意证书检查。
  • 你是不是建议我根本不应该添加引用?

标签: ios ssl xamarin.ios asmx system.net


【解决方案1】:

这是一个信任问题。如果可以接受 TLS/SSL 连接,您的应用程序依赖于 Mono 和 iOS 证书存储。默认情况下,自签名证书不是(因为 Mono 和 iOS 都不知道它们)。

就像在 cmets 中提到的那样,使用 System.Net.ServicePointManager.ServerCertificateValidationCallback 可能是最简单的解决方案 - 但盲目地返回 true 不是:-)

Mono-project 网站上有一篇 wiki 文章描述了几个选项: http://www.mono-project.com/UsingTrustedRootsRespectfully

【讨论】:

  • 谢谢!这为我节省了很多时间。
猜你喜欢
  • 1970-01-01
  • 2017-10-30
  • 2019-08-29
  • 2012-11-07
  • 1970-01-01
  • 2013-05-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多