I am receiving the following error on a WCF call:
Maximum number of items that can be serialized or deserialized in an object graph is '65536'
I've read a ton of forum posts and many of them mention modifying the app.config and web.config to specify new behavior to allow larger object graphs. I've done that and this is what I have in those files:
App.Config on the WPF project:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="digiPM.Shell.LogOutPMSEMRService.PMSEMRLogOutService">
<!--<endpoint address="" binding="basicHttpBinding" contract="digiPM.Shell.LogOutPMSEMRService.IPMSEMRLogOutService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/digiPM.Shell.LogOutPMSEMRService/PMSEMRLogOutService/" />
</baseAddresses>
</host>-->
<endpoint address="" binding="netTcpBinding" name="NetTcpBindingEndpoint" contract="digiPM.Shell.LogOutPMSEMRService.IPMSEMRLogOutService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MexTcpBidingEndpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/digiPM.Shell.LogOutPMSEMRService/PMSEMRLogOutService/" />
</baseAddresses>
</host>
</service>
</services>
<!--binding info - removed this for the sake of readability for this post -->
web.config on the service project:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_Services" closeTimeout="01:10:00" openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="01:10:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="4096" maxStringContentLength="2147483647" maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
<reliableSession ordered="true" inactivityTimeout="01:10:00" enabled="false" />
<security mode="None">
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="digiPM.Service.Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="customObjectQuota">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="digiPM.Service.Behavior"
name="digiPM.Service.AddressCrudService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_Services"
name="AddressCrudServiceEndPoint" bindingNamespace="urn:Dawliasoft.Sculpture" contract="digiPM.Services.Contracts.IAddressCrudService" behaviorConfiguration="customObjectQuota" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" behaviorConfiguration="customObjectQuota" />
</service>
<!--<more services defined with same configuration as above..>-->
</services>
</system.serviceModel>
This, however, hasn't helped. Note that the services referenced in the APP.CONFIG are not the services I am having issues with.
I've also tried the following:
added these attributes to the service implementation: [DataContract(IsReference=true)], [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, MaxItemsInObjectGraph = 2147483646)]
wrote a custom DataContractSerializerOperationBehavior class that set MaximumObjectsInGraph and IsReference behavior. Also added custom Attribute to apply this the service implementations. For the sake of clutter, I didn't post the code, but can add it if anyone thinks it would be beneficial.
Thoughts? Ideas? Where do I go from here?
Thanks in advance!