C# 具有证书身份验证的WCF服务引用

C# 具有证书身份验证的WCF服务引用,c#,.net,wcf,x509certificate,C#,.net,Wcf,X509certificate,我已经被提供了一个wcf服务url,私人和公共证书来使用它 My url is https:/xxxx.com/xxxx/xxxx.svc my private certificate is xxx.pfx my public certificate is xxxx.cer 当我尝试从客户端应用程序添加服务引用时,它抛出以下错误 There was an error downloading 'https://xxxx.com/xxxx/xxxx.svc'. The underlying co

我已经被提供了一个wcf服务url,私人和公共证书来使用它

My url is https:/xxxx.com/xxxx/xxxx.svc
my private certificate is xxx.pfx
my public certificate is xxxx.cer
当我尝试从客户端应用程序添加服务引用时,它抛出以下错误

There was an error downloading 
'https://xxxx.com/xxxx/xxxx.svc'.
The underlying connection was closed: 
An unexpected error occurred on a receive.
Unable to read data from the transport connection: 
An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Metadata contains a reference that cannot be resolved: 
'https://xxxx.com/xxxx/xxxx.svc'.
An error occurred while receiving the HTTP response to   
https://xxxx.com/xxxx/xxxx.svc. 
This could be due to the service endpoint binding not using the HTTP protocol. 
This could also be due to an HTTP request context being aborted by the server 
(possibly due to the service shutting down).   
See server logs for more details.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
If the service is defined in the current solution, 
try building the solution and adding  the service reference again.
我已将证书安装在个人、受信任的人、受信任的发布者文件夹下。我没有访问服务器以检查服务器配置的权限。但我被告知,这是为不同的客户工作。我肯定我把证书的安装搞砸了。如果有人能给我指出正确的方向那就太好了

谢谢


Esen

首先尝试从项目中删除服务引用,从web.config中删除system.ServiceModel部分,然后再次添加服务引用。这将迫使VS完全重建system.ServiceModel部分。如果这没有帮助,则需要额外的wcf客户端配置。 下面是如何正确配置wcf客户端以使用证书的一个很好的示例:


如果在此之后仍遇到问题,则可能缺少某些自定义端点行为。在这种情况下,您应该与wcf服务提供商联系。

您必须启用跟踪以查看服务器上发生了什么。您发布的错误消息更一般


http://msdn.microsoft.com/en-us/library/ms733025.aspx

感谢您向我展示了找到问题的途径。跟踪帮助我们解决了服务器中的问题。问题是证书未安装在受信任的文件夹上。