webservice 针对WebService服务,客户端调用时报序列化的最大项数maxItemsInObjectGraph超过65536问题
2016-10-28 10:34
393 查看
今天在使用webservice服务时候,报异常“The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'”,首先看到65536以为是传输的字节数超过了65536的限制,查看服务段配置文件如下:
<httpRuntime executionTimeout="300000" maxRequestLength="2024000"/>
已配置最大请求长度。
客户端配置如下:
<binding name="mySoap" closeTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
同样的配置了最大缓存,最大接受长度,原因不在此。
仔细看异常信息,序列化时,最大项数maxItemsInObjectGraph超过了65536,是最大项数,不是最大字节。
maxItemsInObjectGraph是在服务在一次调用序列化或者反序列化过程中,读或者写对象的最大数目。
经查帮助文档,发现针对maxItemsInObjectGraph配置,默认是65536,服务端(wcf服务)可以通过如下调整:
<behaviors>
<serviceBehaviors>
<behavior name="myBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
而客户端可以通过如下调整:
<behaviors>
<endpointBehaviors>
<behavior name="myBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
配置过后,运行正常。
大家也可以参考http://www.cnblogs.com/wangshuai/archive/2009/12/29/1634978.html
<httpRuntime executionTimeout="300000" maxRequestLength="2024000"/>
已配置最大请求长度。
客户端配置如下:
<binding name="mySoap" closeTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
同样的配置了最大缓存,最大接受长度,原因不在此。
仔细看异常信息,序列化时,最大项数maxItemsInObjectGraph超过了65536,是最大项数,不是最大字节。
maxItemsInObjectGraph是在服务在一次调用序列化或者反序列化过程中,读或者写对象的最大数目。
经查帮助文档,发现针对maxItemsInObjectGraph配置,默认是65536,服务端(wcf服务)可以通过如下调整:
<behaviors>
<serviceBehaviors>
<behavior name="myBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
而客户端可以通过如下调整:
<behaviors>
<endpointBehaviors>
<behavior name="myBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
配置过后,运行正常。
大家也可以参考http://www.cnblogs.com/wangshuai/archive/2009/12/29/1634978.html
相关文章推荐
- WebService的maxItemsInObjectGraph
- WebService调用一对多关联关系时引起问题:A cycle is detected in the object graph
- WCF:Maximum number of items that can be serialized or deserialized in an object graph is '65536'.
- 引用webservice 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。
- WebService 之 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。
- WCF运行时错误 - "MaxItemsInObjectGraph"太小
- WCF中如何修改MaxItemsInObjectGraph的限制
- 引用webservice 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。
- java客户端调用C#webservice服务相关问题
- WCF MaxItemsInObjectGraph
- webservice MaxReceivedMessageSize :已超过传入消息(65536)的最大消息大小配额
- set maxItemsInObjectGraph in client config [from Stackflow]
- webservice接口常见问题1:客户端使用SOAP方式调用CXF服务时异常
- VS+SqlServe 在引用了webservice后刷新数据时提示:已超过传入消息(65536)的最大消息大小配额若要增加配额请使用相应绑定元素上 MaxReceivedMessageSize 属性
- maxItemsInObjectGraph解释
- sharepoint 2013 webservice 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性
- Silverlight – WCF – MaxItemsInObjectGraph
- 如何修改MaxItemsInObjectGraph的限制
- Silverlight – WCF – MaxItemsInObjectGraph
- 2010年07月 小记(telnet,xml命名空间,MaxItemsInObjectGraph, IIS传输限制, memcached Telnet Interface)