Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to add HTTPS enabled WCF Service as Service reference in Visual Studio 2010 IDE

Tags:

c#

wcf

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.

like image 685
rajnish Avatar asked Jun 23 '12 08:06

rajnish


2 Answers

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.

like image 84
lockstock Avatar answered Nov 14 '22 22:11

lockstock


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.

like image 32
Gary.S Avatar answered Nov 14 '22 21:11

Gary.S