c# - MvvmCross 可移植类库 - System.Net.ServicePointManager

标签 c# mvvmcross portable-class-library system.net

在我的 PCL 中,我试图调用 SSL 服务,所以我试图像这样设置 ServerCertificateValidationCallback:

System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertficate;

但我似乎无法在我的 PCL 中添加对 System.Net 的引用,它说 ServicePointManager 类型不存在。

如何在我的 PCL 中引用它?

最佳答案

你不能在你的 pcl 中引用它——它没有在任何当前的可移植子集中定义。

如果您需要使用它,您可以在您的一些 Ui 项目中引用它 - 例如在您的设置类中 - 或者为了重用,您可以构建一个插件来为某些平台引用它。然而,有一些现代平台根本不支持它——WindowsPhone(也许还有 Windows 商店?)

有关将平台特定代码注入(inject) pcl 核心库的更多信息,请参阅 http://slodge.blogspot.co.uk/2013/06/n31-injection-platform-specific.html

关于c# - MvvmCross 可移植类库 - System.Net.ServicePointManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17778781/

相关文章:

c# - 如何使用 Windows shell 获取文件扩展名的大图标?

c# - MVVMCross如何实现ContentDialog

xamarin.ios - 使用 PCL 构建的 Servicestack monotouch DLL

c# - 在 Visual Studio 中创建的 PCL 能否在 Xamarin 项目中使用?

xamarin - SQLite-Net 扩展与 SQLite-Net PCL 的兼容性(注意没有句点)

c# - 删除 OpenXML DOCX 的文档变量?

c# - 为什么 IL.Emit 方法要添加额外的 nop 指令?

c# - 如何对通用列表进行排序?

android - 从堆栈中弹出多个 fragment

android - 如何使用 MvvmCross 将 Android TextView 绑定(bind)到 Click 事件