1
votes

I am trying to consume a WCF service by WCF test client. While it is working fine in same machine when my WCF service/host and client are in different machine it is giving error as

"Error: Cannot obtain Metadata from http://10.15.4.116:8000/hello 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://10.15.4.116:8000/hello
Metadata contains a reference that cannot be resolved: 'http://10.15.4.116:8000/hello'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://10.15.4.116:8000/hello. 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://10.15.4.116:8000/hello The document at the url http://10.15.4.116:8000/hello was not recognized as a known document type.The error message from each known type may help you fix the problem:- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'http://10.15.4.116:8000/hello' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'DISCO Document' is 'There was an error downloading 'http://localhost:8000/hello?disco'.'. - Unable to connect to the remote server - No connection could be made because the target machine actively refused it 127.0.0.1:8000- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'."

Configuration file part of my application is :-

  <configuration>
    <system.serviceModel>
      <behaviors>
        <serviceBehaviors>
          <behavior name="SimpleServiceBehavior">
            <serviceMetadata httpGetEnabled="True" policyVersion="Policy12" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>
  </configuration>
1
Can you post your complete configuration to find out the cause of the errorRajesh
Post the complete config inside <system.serviceModel> - this snippet here is not very useful. Most importantly: which binding are you using?? It seems like you might be using webHttpBinding (REST-style), but the WCF Test Client is for SOAP messages only...marc_s
Currently my config file contains only this part , please tell me which binding should I use for WCF Test clientfunsukvangdu

1 Answers

0
votes

It is the end of your error message that says all about the error :

Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'