Esen
Esen

Reputation: 973

WCF service reference with certificate authentication

I have been provided with a wcf service url, private and public certificate to consume it.

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

Upvotes: 2

Views: 5964

Answers (2)

Senthilkumar Elangovan
Senthilkumar Elangovan

Reputation: 675

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

Upvotes: 1

Gregor Primar
Gregor Primar

Reputation: 6805

First just try to remove service reference from the project, remove system.ServiceModel section from web.config and add service reference again. This will force VS to completly rebuild system.ServiceModel section. If this does not help additional wcf client configuration is required. Here is great sample how to properly configure wcf client to use certificate:

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. In this case you should contact wcf service provider.

Upvotes: 0

Related Questions