错误:InnerException消息为“在对象图中可以序列化或反序列化的最大项目数为'65536".更改对象图或增加MaxItemsInObjectGraph配额. [英] Error: The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota.

查看:50
本文介绍了错误:InnerException消息为“在对象图中可以序列化或反序列化的最大项目数为'65536".更改对象图或增加MaxItemsInObjectGraph配额.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器端web.config

Server side web.config

 服务器端web.config

 Server side web.config

 < system.serviceModel>
  < bindings>
   < wsHttpBinding>
   < binding name =" WSHttpBinding_DataService" closeTimeout ="01:00:00" openTimeout ="10:00:00" receiveTimeout ="10:00:00"; sendTimeout ="10:00:00"; passupProxyOnLocal =假"

 <system.serviceModel>
  <bindings>
   <wsHttpBinding>
    <binding name="WSHttpBinding_DataService" closeTimeout="01:00:00" openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" bypassProxyOnLocal="false"

transactionFlow =假". hostNameComparisonMode ="StrongWildcard" maxBufferPoolSize ="2147483647"; maxReceivedMessageSize ="2147483647"; messageEncoding =文本" textEncoding ="utf-8"

transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8"

useDefaultWebProxy =" true"; allowCookies ="false">
   < readerQuotas maxDepth ="2147483647" maxStringContentLength =" 2147483647"; maxArrayLength ="2147483647"; maxBytesPerRead ="2147483647"; maxNameTableCharCount ="2147483647"/>
    < reliableSessionordered ="true" inactivityTimeout ="00:10:00"; enabled ="false"/>
    <安全模式=无">
    < transport clientCredentialType ="Windows" proxyCredentialType =无". realm ="/"
    < message clientCredentialType ="Windows" negotiationServiceCredential ="true" algorithmSuite =默认"建立安全性上下文="true"/>
    </security>
   </binding>
  </wsHttpBinding>
  </bindings>
  < services>
  <服务行为配置="DataService.HistoryBehavior"名称="DataService.History">
   <端点地址=" binding ="wsHttpBinding" bindingConfiguration ="WSHttpBinding_DataService"; contract ="DataService.IHistory">
    < identity>
    < dns value ="localhost"/>
    </identity>
   </endpoint>
   <端点地址="mex" binding ="mexHttpBinding" contract ="IMetadataExchange"/>
  </service>
                                    </services>
  <行为>
  < serviceBehaviors>
   <行为名称="DataService.HistoryBehavior">
    < serviceMetadata httpGetEnabled ="true"/>
    < serviceDebug includeExceptionDetailInFaults ="true"/>
           < dataContractSerializer maxItemsInObjectGraph ="2147483647"; />
   </behavior>
  </serviceBehaviors>
  /behaviors>
 </system.serviceModel>

useDefaultWebProxy="true" allowCookies="false">
     <readerQuotas maxDepth="2147483647" maxStringContentLength=" 2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
     <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     <security mode="None">
      <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
      <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
     </security>
    </binding>
   </wsHttpBinding>
  </bindings>
  <services>
   <service behaviorConfiguration="DataService.HistoryBehavior" name="DataService.History">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_DataService" contract="DataService.IHistory">
     <identity>
      <dns value="localhost"/>
     </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
   </service>
                 </services>
  <behaviors>
   <serviceBehaviors>
    <behavior name="DataService.HistoryBehavior">
     <serviceMetadata httpGetEnabled="true"/>
     <serviceDebug includeExceptionDetailInFaults="true"/>
            <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
 </system.serviceModel>

 客户端app.config

 Client side app.config

 < system.serviceModel>
     <诊断wmiProviderEnabled ="true">
       < messageLogging logMalformedMessages ="true" logMessagesAtServiceLevel ="true"; logMessagesAtTransportLevel =" true"/>
      </diagnostics>
      < serviceHostingEnvironment aspNetCompatibilityEnabled =="true"/>
     < bindings>
  < wsHttpBinding>
  < binding name =" WSHttpBinding_IHistory" closeTimeout ="00:01:00"
               openTimeout =" 00:01:00" receiveTimeout ="00:10:00" sendTimeout ="00:01:00"
          BypassProxyOnLocal ="false"; transactionFlow =假". hostNameComparisonMode =" StrongWildcard"
               maxBufferPoolSize ="2147483647" maxReceivedMessageSize ="2147483647"
             &messageEncoding =文字" textEncoding ="utf-8"; useDefaultWebProxy ='"true"
               allowCookies ="false">
           < readerQuotas maxDepth =" 2147483647" maxStringContentLength ="2147483647"; maxArrayLength ="2147483647"
               maxBytesPerRead ="2147483647" maxNameTableCharCount ="2147483647"; />
           < reliableSessionordered ="true" inactivityTimeout ="00:10:00"
                enabled ="false" />
           <安全模式=无"<
              < transport clientCredentialType ="Windows" proxyCredentialType =无"
                                realm =" />
              <消息clientCredentialType ="Windows" negotiationServiceCredential ="true" />
           </security>
         </binding>
   </wsHttpBinding>
     </bindings>
     < client>
 <b;端点地址=" http://khizar-vpc/DataService/History.svc " behaviorConfiguration ="DataService.HistoryBehavior"
            binding =" wsHttpBinding" bindingConfiguration ="WSHttpBinding_IHistory"
           contract ="HistoryService.IHistory" name =" WSHttpBinding_IHistory">
         < identity>
           <b; dns value ="localhost" />
         </identity>
       &/endpoint>
     </client>
     <行为>
      <b; endpointBehaviors>
         <行为名称="DataService.HistoryBehavior">
          <b; dataContractSerializer maxItemsInObjectGraph ="2147483647"/>
         </behavior>
       </endpointBehaviors>
     </行为>
   </system.serviceModel>

 <system.serviceModel>
      <diagnostics wmiProviderEnabled="true">
         <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
      </diagnostics>
       <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
     <bindings>
  <wsHttpBinding>
   <binding name="WSHttpBinding_IHistory" closeTimeout="00:01:00"
               openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
           bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
               maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
               messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
               allowCookies="false">
             <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
             <reliableSession ordered="true" inactivityTimeout="00:10:00"
                 enabled="false" />
             <security mode="None">
                <transport clientCredentialType="Windows" proxyCredentialType="None"
                   realm="" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true" />
             </security>
          </binding>
   </wsHttpBinding>
     </bindings>
     <client>
  <endpoint address="http://khizar-vpc/DataService/History.svc" behaviorConfiguration="DataService.HistoryBehavior"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHistory"
            contract="HistoryService.IHistory" name="WSHttpBinding_IHistory">
          <identity>
             <dns value="localhost" />
          </identity>
        </endpoint>
     </client>
     <behaviors>
        <endpointBehaviors>
          <behavior name="DataService.HistoryBehavior">
            <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          </behavior>
        </endpointBehaviors>
     </behaviors>
   </system.serviceModel>

 

这些是我的配置文件,我对此进行了很多探索,到处发现有人认为maxItemsInObjectGraph增加到2147483647,我这样做了,但是在重现通用列表中的2500条以上记录时仍然出现相同的错误,对于 少于2000条记录,如果我缺少任何内容,请检查上面的配置文件

these are my config files, i have explored a lot on this, everywhere i found people sugested maxItemsInObjectGraph increase to 2147483647, i did this but still its giving me same error on returing more than 2500 records in generic list, working fine for less than 2000 records, please check above config files if i am missing anything

推荐答案

要增加MaxItemsInObjectGraph配额,请在客户端上设置端点行为,在服务器上设置服务行为.
我没有在配置文件中看到任何错误.唯一的例外是服务器和客户端之间的端点合同不匹配,但这是可以预期的.

To increase the MaxItemsInObjectGraph quota, set the endpoint behavior on the client and the service behavior on the server.
I don't see anything wrong in the config files. The only exception is an endpoint contract mismatch between the server and the client but it could be expected.

DataService.IHistory与HistoryService.IHistory.

DataService.IHistory vs. HistoryService.IHistory.

他们真的使用不同的名称空间吗?

Are they really use different namespaces?


这篇关于错误:InnerException消息为“在对象图中可以序列化或反序列化的最大项目数为'65536".更改对象图或增加MaxItemsInObjectGraph配额.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆