【发布时间】:2014-05-07 12:30:09
【问题描述】:
我有一个应用程序现在需要部署到应用商店,因为有了 Gatekeeper,它正在慢慢变得不可避免。
唯一的问题是网络请求似乎失败了,因为它们甚至没有被触发。
以下代码 sn-p 已从 Xamarin Bugzilla 文章中提取,并在为 Release 和 Debug 构建时成功;
try
{
WebClient test = new WebClient();
Console.WriteLine("Testing SSL GET...");
string testresponse = test.DownloadString(checkFileUrl);
Console.WriteLine("testresponse = " + testresponse);
} catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine(e.InnerException.Message);
}
但是,当我使用沙盒和网络 IO 授权切换到 AppStore 构建时,请求永远不会被发送出去,正如 Charles 在非 SSL 解密模式下所验证的那样。以下内容从控制台吐出;
Testing SSL GET...
Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
The authentication or decryption has failed.
这似乎是问题所在,因为我们使用对 IIS 服务的 SOAP 调用来执行操作,首先是登录。对于调试和发布,登录工作正常,因为调用已完成。再一次,AppStore 构建甚至没有尝试建立联系。
证书有效,并且 CA 已安装在我的钥匙串中。
在此之前,我在代码中(在调试中)遇到了一些异常,例如;
System.Exception..ctor (message="invalid encoding specification.") in /private/tmp/source/bockbuild-mono-3.2.6/profiles/mono-mac-xamarin/build-root/mono-3.2.6/mcs/class/corlib/System/Exception.cs:81
和
System.Exception..ctor (message="Store Root doesn't exists.") in /private/tmp/source/bockbuild-mono-3.2.6/profiles/mono-mac-xamarin/build-root/mono-3.2.6/mcs/class/corlib/System/Exception.cs:81
和
System.Exception..ctor (message="Store CA doesn't exists.") in /private/tmp/source/bockbuild-mono-3.2.6/profiles/mono-mac-xamarin/build-root/mono-3.2.6/mcs/class/corlib/System/Exception.cs:81
这仍然让我相信这是一个证书问题。测试 URL 是 S3 链接,登录服务器是具有有效证书的 EC2 实例。
干杯。
【问题讨论】:
-
我也遇到过类似的问题,当我使用
http而不是https时一切正常,但我想如果您需要SSL,这并不能解决您的问题
标签: c# ssl mono ssl-certificate xamarin.mac