问题描述
我正在尝试调试通过WCF发送大量数据时出现的问题.从System.ServiceModel.CommunicationException引发的错误消息是:
尝试序列化参数http://tempuri.org/:batch时发生错误. InnerException消息是在对象图中可以序列化或反序列化的最大项目数为'65536'.更改对象图或增加MaxItemsInObjectGraph配额. '.有关更多详细信息,请参阅InnerException."
我已经尝试更改在web.config服务和客户端app.config服务中可以找到的所有内容,但是对我来说没有任何用处.我从web.config中获得的相关部分是:
< system.serviceModel>
< wsHttpBinding>
maxBufferPoolSize ="10485760"; maxReceivedMessageSize ="2147483647"< readerQuotas maxStringContentLength ="8192" maxArrayLength ="20971520" />
.< reliableSession enabled ="true"; ordered ="true" />
<安全模式=无">
< transport clientCredentialType =无" />
.< message EstablishmentSecurityContext ="false"; />
</security>
</bindings> "SyncWebService.SyncEndpoint" behaviorConfiguration =" WSHttpBinding_ISyncEndpoint_Behaviour">
< host>
< baseAddresses< baseaddresses>
< add baseAddress ="" http://localhost:3923/< Syncpoint. </baseAddresses>
</host>
< endpoint binding =" wsHttpBinding" bindingConfiguration ="WSHttpBinding_ISyncEndpoint"; contract ="SyncWebService.ISyncEndpoint" />
</service>
</services>
<行为>
< !!-< endpointBehaviors>
< datacontractSerializer maxItemsInObjectGraph ="2147483647"/> 2147483647
< serviceMetadata httpGetEnabled ="true"; />
< serviceDebug includeExceptionDetailInFaults ="true"; />
的</behavior>
的</endpointBehaviors>->
的< serviceBehaviors>
< dataContractSerializer maxItemsInObjectGraph ="2147483647"/<
.< serviceMetadata httpGetEnabled ="true"; />
< serviceDebug includeExceptionDetailInFaults ="true"; />
</behavior>
</serviceBehaviors>
</behaviors<
</system.serviceModel>
app.config是:
< system.serviceModel>
< bindings>
< ;!-Http绑定设置->
< wsHttpBinding>
; binding name =" WSHttpBinding_ISyncEndpoint" ;; closeTimeout ="05:01:00"; openTimeout ="05:01:00"; receiveTimeout ="05:10:00" BypassProxyOnLocal ="false"; transactionFlow =假". hostNameComparisonMode ="StrongWildcard" maxBufferPoolSize ="2147483647"; maxReceivedMessageSize ="2147483647"; messageEncoding =文本" textEncoding ="utf-8"; useDefaultWebProxy ="true"; allowCookies ="false">
< ;!-< readerQuotas maxDepth ="2147483647"; maxStringContentLength ="2147483647"; maxArrayLength ="2147483647"; maxBytesPerRead ="2147483647"; maxNameTableCharCount ="2147483647"; />->
< readerQuotas maxStringContentLength =" 8192" maxArrayLength ="20971520" />
.< reliableSessionordered ="true"; inactivityTimeout ="05:50:00" enabled ="true" />
<安全模式=无">
< transport clientCredentialType ="Windows" proxyCredentialType =无". realm =" />
.< message clientCredentialType ="Windows"; negotiationServiceCredential ="true"建立安全性上下文=真". />
</security>
</bindings>
</wsHttpBinding>
</bindings>
< client><< client><> ;! SyncWebService远程Web服务(称为SyncEndpoint.svc)的通信通道-<!-< endpoint address ="http://localhost:3923/SyncEndpoint.svc" binding ="wsHttpBinding" bindingConfiguration ="WSHttpBinding_ISyncEndpoint"; contract ="SyncWebService.ISyncEndpoint" name ="WSHttpBinding_ISyncEndpoint"; />->
.< endpoint address =" http://localhost:3923/SyncEndpoint.svc"; binding ="wsHttpBinding"
bindingConfiguration ="WSHttpBinding_ISyncEndpoint" contract ="SyncWebService.ISyncEndpoint" name ="WSHttpBinding_ISyncEndpoint"
行为配置="WSHttpBinding_ISyncEndpoint_Behaviour"; />
</client>
<行为>
;/> <!-2147483647--<//behavior>
<//endpointBehaviors>
<!-< serviceBehaviors>
>
< dataContractSerializer maxItemsInObjectGraph =''2147483647''/>
</behavior<</serviceBehaviors>><><> /system.serviceModel>
这给我带来了一个大问题,因此,如果有人有想法,将不胜感激.
TIA,
Ciaran O'Neill
推荐答案
您在客户端使用哪个操作系统,以及.NET版本?您是否在此合同中使用DataContractSerializer?
这篇关于在对象图中可以序列化或反序列化的最大项目数为'65536'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!