当我尝试在 WCF 中传输大量数据时,出现此错误:
格式化程序在尝试反序列化消息时抛出异常:尝试反序列化参数 http://tempuri.org/:requete时出错。InnerException 消息是“反序列化 System.String 类型的对象时出错。读取 XML 数据时已超出最大字符串内容长度配额 (8192)。可以通过更改创建 XML 阅读器时使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性来增加此配额。第 1 行,位置 8843.'。有关更多详细信息,请参阅 InnerException。
这是我的app.config
文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" maxBufferSize="52428800" maxBufferPoolSize="52428800">
<readerQuotas maxStringContentLength="52428800" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TSO_WCF.Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/TSO_WCF/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="wsHttpBinding" contract="TSO_WCF.IService1" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<appSettings>
<add key="Mapping" value="D:\workspace\oddo.app.ldw.tsomanagertool\ProjetTSO\MappingsXML"/>
</appSettings>
</configuration>