2

我已经获得了一个 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.

我将证书安装在个人、受信任的人、受信任的发布者文件夹下。我无权访问服务器来检查服务器配置。但有人告诉我,这适用于不同的客户。我确定我弄乱了证书的安装。如果有人能指出我正确的方向,那就太好了。

谢谢,

埃森

4

2 回答 2

1

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

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

于 2012-09-07T17:12:21.773 回答
0

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

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

如果在此之后您仍然遇到问题,您可能会丢失一些自定义端点行为。在这种情况下,您应该联系 wcf 服务提供商。

于 2012-08-31T17:20:21.650 回答