Toady we ran into an issue where the serialization graph of our objects exceeded the default max limits (yea I know, I need to resolve this as my root issue, but one step at a time). When I used the WcfTestClient to test for a working solution for my problem I simply had to make a few config changes. In fact I only needed to add the following to my config
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
contract="IAppointments" name="Client.EndpointConfiguration" />
However, because we are not using straight config to drive our WCF this solution was not something we could use. Long story short we basically spin up our endpoints on our client dynamically. Because of this we need to set the MaxItemsInObjectGraph property by hand. I had expected i could create an instance of my endpoint Behavior I had created above (Client.EndpointConfiguration) and push this behavior to my at the service level and be done with it. But from all my googling all I could find online has you setting this property on each operation on the contract.
foreach ( var operation in channelFactory.Endpoint.Contract.Operations )
var behavior = operation.Behaviors.Find() as DataContractSerializerOperationBehavior;
if ( behavior != null )
behavior.MaxItemsInObjectGraph = 2147483647;
Now, I am reaching out to the blogosphere to ask, is there a better way to do this?
Till next time,
05-04-2010 1:06 PM