0

When updating a WCF service reverence I am intermittently getting 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'". It happens around 50% of the time. I update the service referince. It fails. I update again (no changes) and it works.

EDIT: service web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647"></binding>
      </basicHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
  </system.serviceModel>
</configuration>

client web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation batch="false" debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="200000" executionTimeout="3600" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IMyAppData" closeTimeout="Infinite"
          openTimeout="Infinite" receiveTimeout="Infinite" sendTimeout="Infinite"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/MyApp.Data.Host/MyApp.Data.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyAppData"
        contract="DataClient.IMyAppData" name="BasicHttpBinding_IMyAppData" />
    </client>
    <services>
    </services>
  </system.serviceModel>
</configuration>
Erik Blessman
  • 573
  • 3
  • 11

1 Answers1

0

I sounds like you have a binding mismatch between the service and the client binding configuration. If you want a proper answer provide us with the .config file for the service and the client. How do you update your service reference?

Perhaps related: Content Type text/xml; charset=utf-8 was not supported by service

Community
  • 1
  • 1
Jocke
  • 2,189
  • 1
  • 16
  • 24