Omar Kooheji
Omar Kooheji

Reputation: 55760

Issue while generating a service proxy from WSDL with invalid SSL Certificate

I'm trying to write a small app that accesses a webservice, but the webservice has an invalid SSL certificate. I've got no control over this fact as it's governed by a third party.

I've tried accessing the site via IE (As administrator and as my own user) and installing the certificate but it doesn't seem to do very much, as the next time I browse to it I get the same error.

When I run svcutil I get the following output:

C:\Personal>svcutil.exe https://b2b:9443/LiveFeed.svc?wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'https://b2b:9443/LiveFeed.svc?wsdl' using
WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from https://b2b:9443/LiveFeed.svc?wsdl

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: https://b2b:9443/LiveFeed.svc?wsdl

    Metadata contains a reference that cannot be resolved: 'https://b2b:9443/Liv
eFeed.svc?wsdl'.

    Could not establish trust relationship for the SSL/TLS secure channel with a
uthority 'b2b:9443'.

    The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.

    The remote certificate is invalid according to the validation procedure.


HTTP GET Error
    URI: https://b2b:9443/LiveFeed.svc?wsdl

    There was an error downloading 'https://b2b:9443/LiveFeed.svc?wsdl'.

    The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.

    The remote certificate is invalid according to the validation procedure.

If you would like more help, type "svcutil /?"

I know the issue is to do with the certificate being invalid, but I can't seem to make the certificate trusted. How would I go about doing this?

What I have done so far is click on the error, view the certificate, and install it. I've tried this in the certificate store that windows selects it's self and in the personal and trusted stores, none of this makes a difference.

Even if I manage to solve this I'm concerned that I'll run into issue when I install the application on my customers PC, given that we are in two different countries.

Any help would be appreciated.

Upvotes: 4

Views: 4772

Answers (3)

Usama Khalil
Usama Khalil

Reputation: 436

  try this before calling the service..

  ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(
            delegate
            {
                return true;
            });

Upvotes: 0

Jim Flood
Jim Flood

Reputation: 8457

The answers for this question might help you: .net WebService, bypass ssl validation!

Upvotes: 0

Doobi
Doobi

Reputation: 4842

It may be as simple as installing the root CA certificate for the cert.

Upvotes: 1

Related Questions