【发布时间】: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