如何关闭WCF服务客户端的证书吊销?客户端代理由wsdl.exe生成并继承SoapHttpClientProtocol.
我想你在找 ServicePointManager.ServerCertificateValidationCallback
:
http://msdn.microsoft.com/en-gb/library/system.net.servicepointmanager.servercertificatevalidationcallback.aspx
需要一个 RemoteCertificateValidationCallback
代表:
http://msdn.microsoft.com/en-gb/library/system.net.security.remotecertificatevalidationcallback.aspx
我之前从未处理过撤销的证书(我有办法解决其他问题,比如过期的SSL),但我猜你只是做了类似的事情:
class Program { static void Main(string[] args) { ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateCertificate); // Do WCF calls... } public static bool ValidateCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if(sslPolicyErrors == SslPolicyErrors.RemoteCertificateChainErrors) { foreach(X509ChainStatus chainStatus in chain.ChainStatus) { if(chainStatus.Status == X509ChainStatusFlags.Revoked) { return true; } } } return false; } }