当前位置:编程学习 > C#/ASP.NET >>

格式化程序尝试对消息反序列化时引发异常

 格式化程序尝试对消息反序列化时引发异常: 尝试对参数 http://tempuri.org/ 进行反序列化时出错: GetXResult。InnerException 消息是“对象图中可以序列化或反序列化的项目数目上限为“65536”。请更改对象图或增加 MaxItemsInObjectGraph 的配额。”。有关详细信息,请参见 InnerException。 ---> System.Runtime.Serialization.SerializationException: 对象图中可以序列化或反序列化的项目数目上限为“65536”。请更改对象图或增加 MaxItemsInObjectGraph 的配额。

 客户端:
  <netTcpBinding>
        <binding name="NetTcpBinding_IServices" closeTimeout="00:03:00"
          openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00"
          transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
          hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647"
          maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>

服务端:
<endpoint   binding="netTcpBinding" bindingConfiguration="BasicBindingConfig"
            contract="IPolicy.IServices"/>
        <endpoint
            binding="netNamedPipeBinding"
            contract="IPolicy.IServices"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="False"/>
          <serviceDebug includeExceptionDetailInFaults="True" />
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="BasicBindingConfig"  maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        </binding>
      </netTcpBinding>
    </bindings>

还有什么没设置到得吗?不解 --------------------编程问答--------------------  <dataContractSerializer maxItemsInObjectGraph="6553600"/>改大点试试 --------------------编程问答-------------------- 改了 2147483647 还是一样 --------------------编程问答-------------------- services和client都要改,参见

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c85f3ed2-0b55-4375-af79-5926b6cc527c/ --------------------编程问答-------------------- 根据楼上给的链接,修改后
服务器未提供有意义的回复;这可能是由协定不匹配、会话过早关闭或内部服务器错误引起的。 --------------------编程问答-------------------- 是不是跟我要返回的数据有关?
List<List<T>> --------------------编程问答-------------------- 具体如何解决的啊? --------------------编程问答-------------------- <dataContractSerializer maxItemsInObjectGraph="6553600"/> 客户端也加上试试。我的
     <system.serviceModel>
        <behaviors>
            <endpointBehaviors>
                <behavior name="SerializerCOUNT">
                    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
                </behavior>
            </endpointBehaviors>
        </behaviors>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IAssetManagement" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address=""
                behaviorConfiguration="SerializerCOUNT" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IAssetManagement" contract="IAssetManagement"
                name="BasicHttpBinding_IAssetManagement" />
        </client>
    </system.serviceModel>
补充:.NET技术 ,  Web Services
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,