Certificate validation doesn't use proxy settings for chaintrust

China☆狼群 提交于 2019-12-13 21:04:31

问题


I've been struggling to get a WCF client to work through a web proxy. If I manually specify the proxy as below, I can get the http request to work.

WebProxy proxy = new WebProxy("http://x.x.x.x:3128", false);
proxy.Credentials = new NetworkCredential("user", "pass");
WebRequest.DefaultWebProxy = proxy;

However I have the client service proxy set to use ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.ChainTrust;

Inspecting the packets that get sent out, the client successfully connects to the server, but the then tries to validate the certificate that the service provides. This validation attempt fails because the requests for the chain do not have Proxy-Authorization headers (they fail with 407 errors). How can I get these requests to properly use the DefaultWebProxy that's specified?

If I set the validation mode to None, then it all works of course, but I really don't want to have to do that.


回答1:


this setting only affects message level certificates. for transport level try something like this http://webservices20.blogspot.co.il/2008/12/wcf-gotcha-disabling-ssl-validation.html



来源:https://stackoverflow.com/questions/10953247/certificate-validation-doesnt-use-proxy-settings-for-chaintrust

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!