我正在尝试调用读取XML字符串的WCF服务。我收到这个错误 “Formater错误最大字符串内容长度配额 读取XML数据时已超出(8192)。“下面是Service web.config文件
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IOrderCreateService"
maxReceivedMessageSize="2147483647"
openTimeout="00:1:00"
closeTimeout="00:1:00"
sendTimeout="00:25:00"
receiveTimeout="00:25:00">
</binding>
<binding name="HandleLargeMessage" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<!-- beta.telagententerprise.com/WcfServices-->
<service name="OrderCreateService.OrderCreateService">
<endpoint name="MessageServiceEndpoint"
address="http://localhost:2966/OrderCreateService.svc"
binding="basicHttpBinding"
bindingConfiguration="HandleLargeMessage"
contract="IOrderCreateService" />
</service>
</services>
</system.serviceModel>
以下是客户端app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IOrderCreateService"
maxReceivedMessageSize="2147483647"
openTimeout="00:1:00"
closeTimeout="00:1:00"
sendTimeout="00:25:00"
receiveTimeout="00:25:00">
</binding>
<binding name="HandleLargeMessage" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="MessageServiceEndpoint"
address="http://localhost:2966/OrderCreateService.svc"
binding="basicHttpBinding"
bindingConfiguration="HandleLargeMessage"
contract="OrderCreateService.IOrderCreateService" />
</client>
</system.serviceModel>
我搜索了这个错误尝试上面的代码仍然得到8192错误。 任何帮助都会很棒。 谢谢, 小号
答案 0 :(得分:0)
服务器端配置 - &gt;端点元素合同值不完全合格。应为OrderCreateService.IOrderCreateService
此外,如果您在IIS上托管,则映射到服务的地址由IIS处理。
答案 1 :(得分:0)
即使在客户端和Server .config文件上设置maxStringContentLength =“2147483647”后,我也遇到了同样的问题。在Web上尝试了许多建议后,通过在客户端和Server项目上匹配目标框架(在Visual Studio 2013中的Project Properties / build选项卡/ Platform目标下)来修复它。