0
votes

When attempting to add a service reference to a WCF service to my .NET project I am getting an error:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

After doing some research I decided to add a metadate exchange endpoint to my service:

<endpoint 
  address="mex" 
  binding="mexHttpsBinding" 
  contract="IMetadataExchange"/>

Now, after adding the enedpoint I am getting a different type of error:

Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https].

What am I doing wrong here?

If I open service in the browser, it works just fine:

https://alias.domain.com/ProjectName/MyService.svc?wsdl

2

2 Answers

1
votes

mexHttpBinding is only for http:// but as your service is exposed over https:// you need to change it to mexHttpsBinding.

See here: https://msdn.microsoft.com/en-us/library/aa395212(v=vs.110).aspx

0
votes

Solved!

The issue was that some XSD references in WSDL, schemaLocation in particular. For some reason schemaLocation used machine name instead of the domain name. After I fixed that I was able to add a reference to the service