我在 Azure 上有 WCF 自托管服务。我正在尝试制作桌面客户端和 Metro 风格的 App 客户端。我正在使用带有传输安全性和自签名证书的 nettcpbinding。
在 Windows 7 上,此代码有效:
client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
client.GetUpdate(...);
但在地铁应用程序上,该字段ServiceCertificate
不存在,所以我得到了(预期的)异常
The X.509 certificate CN=SPDEV-1-PC chain building failed.
The certificate that was used has a trust chain that cannot be verified.
Replace the certificate or change the certificateValidationMode.
A certificate chain processed, but terminated in a root certificate
which is not trusted by the trust provider.
如何更改 certificateValidationMode ?