【问题标题】:Intermittent error while updating service reference "cannot process the message because the content type..."更新服务引用时出现间歇性错误“无法处理消息,因为内容类型...”
【发布时间】:2015-02-24 19:17:46
【问题描述】:

更新 WCF 服务时,我间歇性收到错误“无法处理消息,因为内容类型 'application/soap+xml; charset=utf-8' 不是预期的类型”文本/xml;字符集=utf-8'"。 大约 50% 的时间会发生这种情况。我更新了服务参考。它失败。我再次更新(没有更改)并且它有效。

编辑: 服务 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>

客户端 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>

【问题讨论】:

    标签: asp.net wcf service-reference


    【解决方案1】:

    听起来您的服务和客户端绑定配置之间的绑定不匹配。如果您想要正确的答案,请向我们提供服务和客户端的 .config 文件。您如何更新您的服务参考?

    也许相关: Content Type text/xml; charset=utf-8 was not supported by service

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-14
      • 1970-01-01
      • 2014-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-22
      • 2012-02-02
      相关资源
      最近更新 更多