WinRT中是否可以将客户端证书附加到SOAP客户端请求? 在以前的版本中,您只需执行以下操作:
MyServiceSoapClient client = new MyServiceSoapClient()
X509Certificate2 cert = CertificateHelper.GetClientCertificate();
client.ClientCredentials.ClientCertificate.Certificate = cert;
但ClientCertificate属性似乎不再可用。 我怎样才能在UWP中实现这一目标?
谢谢。
答案 0 :(得分:0)
试试这个:
var client = new ServiceClient();
client.Endpoint.Address = new EndpointAddress(url);
BasicHttpBinding binding = client.Endpoint.Binding as BasicHttpBinding;
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
client.ClientCredentials.ClientCertificate.Certificate = ...
您可以编辑证书以符合您的要求:)
服务客户端文档 https://msdn.microsoft.com/en-ca/library/mt185502.aspx