I have been encountering issues with a custom WCF service deployed to SharePoint 2010. I'm receiving the following error when trying to import some data into the client:
'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. '.
I have attempted to make a number of changes using the mechanism outlined on http://shaunedonohue.blogspot.com/2011/03/reader-quotas-for-wcf-services-in_4706.html, but I am still receiving this error - the开发者_JAVA技巧se quota settings do not seem to have bearing on the MaxItemsInObjectGraph setting. Changing this setting in the ServiceBehaviour attribute of the service does not seem to work either.
Has anyone encountered this issue before?
I was able to resolve this issue by following the steps outlined in How to fix MaxItemsInObjectGraph error?, in addition to the information from Shaune's blog. That is to say:
The WCF ServiceBehavior attribute required the MaxItemsInObjectGraph to be set as follows:
[ServiceBehavior(Namespace = "http://www.mydomain.net/MyApp/SharePoint", Name = "MySharePoint2010Service", MaxItemsInObjectGraph = 65536000)]
The client needed to be updated to change the serialization behaviour as outlined in the above issue, before the channel was created.
I have not been able to find anyone else who has encountered this issue with SharePoint 2010 before, but hopefully this should help someone out in the future. SharePoint's dynamic configuration is not quite comprehensive enough to cover all WCF settings, but it is still much preferred to manually updating web.config files throughout the farm.
精彩评论