tags:

views:

163

answers:

2

Hi guys,i give an error when connect my wcf service,

The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)

My wcf service config file below this:

<?xml version="1.0"?>
<configuration>
    <customErrors mode="Off">
    </customErrors>
  <system.serviceModel>
    <services>
      <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="http://127.0.0.1/ChickenService/Service1.svc" binding="basicHttpBinding" contract="WcfService1.IService1">
          <identity>
            <dns value="127.0.0.1"/>
          </identity>
        </endpoint>
       <host>
          <baseAddresses>
            <add baseAddress="http://127.0.0.1/"/&gt;
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService1.Service1Behavior">
      <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

How can i solve this problem?

+1  A: 

Try changing this:

<serviceDebug includeExceptionDetailInFaults="false"/>

to this:

<serviceDebug includeExceptionDetailInFaults="true"/>

and see if the additional information in the error is helpful (also add that information to the post).

Andrew Hare
A: 

It sounds like you are getting an ASP.NET Error Page (a.k.a "T*he Yellow Screen Of Death*") when invoking your WCF service, which would explain why the response's MIME type is text/html.
Are you hosting your service in IIS?

After you have enabled exception details like Andrew suggested, you can copy the contents of the exception message you get back from the service, which will be a long HTML string, paste it in a new text file, save it as .HTML and open it in a web browser to look at the error details.

Enrico Campidoglio