Tôi nhận được ngoại lệ sau khi cố gắng chuyển DTO qua các dịch vụ WCF.WCF Đọc tối đa Ngoại lệ Độ sâu
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
vẻ Các app.config ràng buộc như hành vi dịch vụ
<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 này:
Và DTO trông như thế này:
[Serializable]
[DataContract(IsReference=true)]
public class MyDto
{
Bất kỳ giúp đỡ sẽ được đánh giá cao như tôi kéo tóc tôi ra.
Bạn đã thay đổi cấu hình trên cả client và server? Tôi có ấn tượng rằng tôi đã phải phù hợp với sự thay đổi này trên cả hai người họ trước đây. –
Khá khác thường khi làm tổ sâu. Bạn có thể có một tham chiếu vòng tròn. Tôi nghĩ chúng ta cần xem thêm về DTO đó; thay đổi tổ tối đa chỉ có thể là giải pháp hỗ trợ băng thông. – Aaronaught
Tôi giải quyết vấn đề của mình như tôi đã giải thích ở đây: http://stackoverflow.com/questions/5537794/error-while-deserializing-the-object-in-wcf – Adi