I'm having a problem with the WCF Test Client. I cannot connect to my WebService because it keeps hitting this error:
Error: Cannot obtain Metadata from http://xxx.xxxxxxxx.xxx/DPITerminal.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 at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://xxx.xxxxxxxx.xxx/DPITerminal.svc
Metadata contains a reference that cannot be resolved: 'http://xxx.xxxxxxxx.xxx/DPITerminal.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://xxx.xxxxxxxx.xxx/DPITerminal.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error URI: http://xxx.xxxxxxxx.xxx/DPITerminal.svc There was an error downloading 'http://xxx.xxxxxxxx.xxx/DPITerminal.svc'.
Here is my Web.Config: Link.
As you can see, I already have the
<serviceMetadata httpGetEnabled="true" />
as well as
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="mex" contract="IMetadataExchange" />
as suggested in the other StackOverflow questions. Still doesn't work.
I also noticed that when I comment the following endpoint:
<endpoint address="x" behaviorConfiguration="poxBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="xxx.xxxxxxxx.xxxxxx.WebService.IDPITerminal" />
Everything works as expected. So I guess there's a problem with my XML Endpoint? It's weird since the XML Endpoint is sharing the JSON Endpoint's binding configuration, and the JSON one doesn't have any problems.
Also, Let me clarify that I'm only having problems with the WCF Test Client. The JSON & the XML Endpoint is both working properly.
EDIT:
I tried to comment the XML Endpoint, publish, then connect via the WCF Test Client. Then I uncommented the XML Endpoint, republish. The WCF Test Client still works- I mean I can send and receive data. When I refreshed the service, the Cannot obtain Metadata error popped out again.