当遇到这个错误的时候郁闷了好长时间报错是字符串长度过大可是修改了MaxStringContentLength”属性的值却不起作用最后才发现还是因为配置文件配置的问题在服务端
格式化程序尝试对消息反序列化时引发异常: 尝试对参数 http://tempuri.org/ 进行反序列化时出错: GetLzdtArticleResult。InnerException 消息是“反序列化对象 属于类型 lzdt.DTO.Dtolzdt[] 时出现错误。读取 XML 数据时,超出最大字符串内容长度配额 (8192)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性,可增加此配额
尽管我设置了“MaxStringContentLength”属性的值,但有这个错误...后来发现在服务端终结点配置上必须增加绑定配置属性 bindingConfiguration="BasicHttpBinding_NewBind"才起作用 ,恍然大悟,记录博客备忘决不允许再犯这样低级的错误!!!!!!!!
<services>
<service name="Gps.OpenAPI.WebService.GpsWebService" behaviorConfiguration="liuyaokai_behavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:13700/GpsWebService.svc"/>
</baseAddresses>
</host>
<endpoint name="BasicHttpBinding_IGpsWebService" address="" binding="basicHttpBinding" contract="Gps.OpenAPI.WebService.IGpsWebService" bindingConfiguration="BasicHttpBinding_NewBind" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<basicHttpBinding>
<binding name="BasicHttpBinding_NewBind" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="5242880000" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="409600" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>