zoukankan      html  css  js  c++  java
  • WCF运行时错误

    当服务器返回的数据量过大时,客户端显示通信错误。

    今天遇到的问题是“对象图中需要序列化或反序列化的项目数目超过了上限“65536”。

    这个问题需要在WCF系统的服务段和客户端分别修改配置来增加这个上限。

    服务段修改如下:

    <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="default">
              <serviceMetadata />
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service name="*" behaviorConfiguration="default">
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:1200" />
              </baseAddresses>
            </host>
            <endpoint binding="netTcpBinding" />
            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
          </service>
        </services>
      </system.serviceModel>

    客户端修改如下:

    <system.serviceModel>
        <client>
          <endpoint name="*" address="net.tcp://127.0.0.1:1200" contract="*" binding="netTcpBinding" behaviorConfiguration="default" />
        </client>
        <behaviors>
          <endpointBehaviors>
            <behavior name="default">
              <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
          </endpointBehaviors>
        </behaviors>
      </system.serviceModel>
  • 相关阅读:
    hlg1541集合划分【01背包】
    HLG1067QQ Farm【状压dp】
    作业。。
    HDU3602 2012【dp】
    hdu 1233(最小生成树 prim算法)
    hdu 2988(最小生成树 kruskal算法)
    hdu 1272
    hdu 1213(并查集模版题)
    hdu 2846(字典树)
    hdu 1075(字典树)
  • 原文地址:https://www.cnblogs.com/hyping/p/4449078.html
Copyright © 2011-2022 走看看