5
votes

While adding a HTTPS enabled WCF Service as Service reference through Visual Studio 2010 IDE, the following exception occured

There was an error downloading 'https://abc.cloudapp.net/DataService.svc'. The request failed with HTTP status 403: Forbidden. Metadata contains a reference that cannot be resolved: 'https://abc.cloudapp.net/DataService.svc'. The HTTP request was forbidden with client authentication scheme 'Anonymous'. The remote server returned an error: (403) Forbidden. If the service is defined in the current solution, try building the solution and adding the service reference again.

Please suggest me a solution for this.

5

5 Answers

9
votes

Another possible solution is to make sure that Visual Studio knows which certificate to use by setting it in credential manager.

Open credential manager and under Certificate-Base credentials click Add a certificate-based credential.

Enter the URL of your service reference and select the certificate from the store.

3
votes

The issue is the metadata binding. You must allow https GET to use the same URL for metadata and the service itself.

<serviceMetadata httpsGetEnabled="true" />

This will allow WCF to serve the metadata over HTTPS.

0
votes

I had encountered this issue earlier, try adding http://abc.cloudapp.net/DataService.svc (that's correct without https) and once the the service is added, make the change in web.config file from http to https.

0
votes

Can you access https based URL on IE and get WSDL? If you can get WSDL in IE without any problem then you do have certificate installed in your machine and VS somehow not able to use the client certificate and return this error. IF you can not get WSDL in your machine, then you need to install client certificate in your machine first and try again.

IF you want to workaround this issue with Visual Studio, you can use your IE to get the HTTPs WCF service metadata wsdl page and save WSDL on your local machine. After that open VS2010 and when you select "Add ServiceReference", route to saved WSDL metadata file on your machine, this way a Proxy Class for your Secure WCF service will be generated and you can still use it.

0
votes

My issue got resolved by adding my certificate into Browser.

Open Internet Explorer --> Internet Options --> Go to Content --> Click on Certificate --> Import your certificate into Personal Or Trusted Publisher

Then Try to consume the WCF Service, it will warn you a message but click OK, this will resolve the issue.

If it does not resolved, import the same certificate in Server under personal or Trusted people