简体   繁体   English

具有证书身份验证的WCF服务参考

[英]WCF service reference with certificate authentication

I have been provided with a wcf service url, private and public certificate to consume it. 我已经提供了一个wcf服务网址,专用证书和公用证书来使用它。

My url is https:/xxxx.com/xxxx/xxxx.svc
my private certificate is xxx.pfx
my public certificate is xxxx.cer

When I try to add service reference from my client application it throws the following error. 当我尝试从客户端应用程序添加服务引用时,它将引发以下错误。

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.

I have the certificates installed under personal, trusted people, trusted publishers folder. 我将证书安装在个人,受信任的人,受信任的发布者文件夹下。 I don't have access to the server to check the server configuration. 我无权访问服务器以检查服务器配置。 But I have been told that this is working for different client. 但是我被告知这适用于不同的客户。 I am sure I am messing the installation of certificates. 我确定我搞砸了证书的安装。 It would be great if someone can point me into the right direction. 如果有人能指出我正确的方向,那就太好了。

Thanks, 谢谢,

Esen 也先

You got to enable tracing to see whats going on at the server. 您必须启用跟踪以查看服务器上发生的情况。 The error message you posted is more generic. 您发布的错误消息更为通用。

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

First just try to remove service reference from the project, remove system.ServiceModel section from web.config and add service reference again. 首先,只需尝试从项目中删除服务引用,从web.config中删除system.ServiceModel部分,然后再次添加服务引用。 This will force VS to completly rebuild system.ServiceModel section. 这将强制VS完全重建system.ServiceModel部分。 If this does not help additional wcf client configuration is required. 如果这样做没有帮助,则需要其他wcf客户端配置。 Here is great sample how to properly configure wcf client to use certificate: 这是一个很好的示例,说明如何正确配置wcf客户端以使用证书:

http://www.codeproject.com/Articles/28248/Securing-WCF-Services-with-Certificates http://www.codeproject.com/Articles/28248/Securing-WCF-Services-with-Certificates

If you are still experiencing problems after this you could be missing some custom endpointBehavior. 如果在此之后您仍然遇到问题,则可能会缺少一些自定义的EndpointBehavior。 In this case you should contact wcf service provider. 在这种情况下,您应该联系wcf服务提供商。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM