尝试通过WCF服务传递DTO时,出现以下异常。WCF最大读取深度异常
System.Xml.XmlException: The maximum read depth (32) has been exceeded because XML data being read has more levels of nesting than is allowed by the quota. This quota may be increased by changing the MaxDepth property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 5230.
at System.Xml.XmlExceptionHelper.ThrowXmlException
在app.config结合看起来像这样
<binding name="WSHttpBinding_IProjectWcfService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="10240000" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="200" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
Web.config文件服务行为:
而且DTO是这样的:
[Serializable]
[DataContract(IsReference=true)]
public class MyDto
{
任何帮助将不胜感激,因为我用它拉我的头发。
你改变客户端和服务器上的配置?我有这样的印象,我必须在两者之前匹配这一变化。 – 2010-03-25 00:22:55
非常不寻常的嵌套那很深。你可能有一个循环引用。我想我们需要看到更多的DTO;改变最大嵌套可能只是一个创可贴解决方案。 – Aaronaught 2010-03-25 02:16:43
我解决了我的问题,因为我在这里解释:http://stackoverflow.com/questions/5537794/error-while-deserializing-the-object-in-wcf – Adi 2011-12-07 13:18:16