格式化程序嘗試對消息反序列化時引發異常: 嘗試對參數 http://tempuri.org/ 進行反序列化時出錯: GetLzdtArticleResult。InnerException 消息是“反序列化對象 屬於類型 lzdt.DTO.Dtolzdt[] 時出現錯誤。讀取 XML 數據時,超出最大


當遇到這個錯誤的時候郁悶了好長時間報錯是字符串長度過大可是修改了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> 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM