• 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>
  • 相关阅读:
    php反射
    html video api控件总结
    linux CentOS7.2安装ffmpeg-3.0.2
    2019年7月12日星期五(C语言)
    2019年7月11日星期四(C语言)
    2019年7月10日星期三(C语言)
    2019年7月9日星期二(C语言)
    2019年7月8日星期一(C语言)
    2019年7月5日星期五(C语言)
    2019年7月4日星期四(C语言及LINUX命令)
  • 原文地址:https://www.cnblogs.com/hyping/p/4449078.html
Copyright © 2020-2023  润新知