I have a service with four endpoints defined, the configuration looks like this:
<service name="Systembolaget.Services.ButikService" behaviorConfiguration="default">
<endpoint
address="xml"
binding="webHttpBinding"
behaviorConfiguration="xml"
contract="Systembolaget.Contracts.Butiker.IButikService" />
<endpoint
address="json"
binding="webHttpBinding"
behaviorConfiguration="json"
contract="Systembolaget.Contracts.Butiker.IButikService" />
<endpoint
address="soap"
binding="basicHttpBinding"
contract="Systembolaget.Contracts.Butiker.IButikService"
bindingConfiguration="default"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
<behaviors>
<endpointBehaviors>
<behavior name="xml">
<webHttp defaultOutgoingResponseFormat="Xml" defaultBodyStyle="Bare"></webHttp>
</behavior>
<behavior name="json">
<webHttp defaultOutgoingResponseFormat="Json" defaultBodyStyle="Bare"></webHttp>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="default">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
When using the service with any of the end points it all works fine. However I can't use the test client in Visual Studio 2012 if both the xml and the json end point exists. If I comment out one or the other, the client works, if I keep both in the config file I get the following error:
Error: Cannot obtain Metadata from
http://localhost:52832/VarugruppService.svc
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation athttp://go.microsoft.com/fwlink/?LinkId=65455
.WS-Metadata Exchange
URI:http://localhost:52832/VarugruppService.svc
Metadata contains a reference that cannot be resolved:http://localhost:52832/VarugruppService.svc
.
There was no endpoint listening athttp://localhost:52832/VarugruppService.svc
that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.HTTP GET Error
URI:http://localhost:52832/VarugruppService.svc
There was an error downloading 'http://localhost:52832/VarugruppService.svc
'.
The request failed with HTTP status 404: Not Found.
Any ideas?
webHttpBinding
. The REST-basedwebHttpBinding
can be tested directly with a browser or with a tool like FIddler – marc_s