How can I set the maxItemsInObjectGraph for the DataContractJsonSerializer?
I get an error saying "Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota."
Where does the number 65536 come from. The documentation for DataContractJsonSerializer says the default is Int32.MaxValue.
I tried to set it in the behavior configuration:
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp />
<dataContractJsonSerializer maxItemsInObjectGraph="500000"/>
</behavior>
</endpointBehaviors>
but I get an error like: "Invalid element in configuration. The extension name 'dataContractJsonSerializer' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions."
Changing the behavior to <dataContractSerializer maxItemsInObjectGraph="500000"/>
gives no error but doesn't change the value (which is no surprise since I'm not using the dataContractSerializer)
The client is created with a ChannelFactory so I can't use the ServiceBehavior attribute as described here here