新的'对象图中可以序列化或反序列化的最大项数是'65536''错误,没有更改app.config或web.config

时间:2014-03-06 21:37:03

标签: c# wcf serialization datacontractserializer

我们最近获得了一个'对象图中可以序列化或反序列化的最大项目数为'65536'。更改对象图或增加MaxItemsInObjectGraph。'部署新版本的代码后,我们的生产环境出错。

我检查了app.config和web.config文件,旧版本和新版本之间似乎没有什么不同。我们的版本控制报告单个更改:

<httpRuntime maxRequestLength="2147483647"/>

已更改为

<httpRuntime maxRequestLength="52428800"/>

app.config始终设置了MaxItemsInObjectGraph:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IAppService" maxReceivedMessageSize="2147483647" />
        </basicHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="AppServiceBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="LargeObjectGraphBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>        

    <client>
        <endpoint address="http://localhost/AppService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAppService"
            contract="PlaybookService.IAppService" name="BasicHttpBinding_IAppService" />
    </client>
</system.serviceModel>

我们的web.config从不引用maxItemsInObjectGaph,但我们之前从未遇到过任何问题。无论如何它在这里:

<bindings>
  <basicHttpBinding>
    <binding name="App" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

所有内容都在本地,并且在测试环境中,它们都具有相同大小的表。旧版本一直使用几乎相同的配置文件。

有没有人知道可能导致这种情况的原因?

0 个答案:

没有答案