我正在开发使用网络服务的xamarin app。
Xamarin是否支持System.ServiceModel.ClientBase中的X509Certificate?
使用.Net 4.5构建的项目中的下一个代码:
public void Initialize()
{
var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
var endpoint = new EndpointAddress("https://ThereIsMyServerAddress/PathToService");
_mobileService = new ServiceClient(binding, endpoint);
_mobileService.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2("Ivanov_Ivan_Ivanovich.cer");
}
但Xamarin在ClientCredentials中没有看到ClientCertificate.Certificate。
是否有任何解决方案可以将证书添加到ServiceClient?
答案 0 :(得分:0)
必须以依赖方式完成,而不是通过PCL,请参阅https://forums.xamarin.com/discussion/comment/271718#Comment_271718