简体   繁体   中英

ASP.NET Web API - How to alter the maximum amount of items in an XML Object Graph

When returning a large amount of XML data through an ASP.NET Web API service the error: HTTP Error 500 (Internal Server Error) is produced. This error is usually found when there is a circular dependency in the model but this is not the case here as the data returns perfectly when there is a smaller amount of data.

The error seems to be produced when the amount of nodes surpasses 60,000, after doing some research I found that there is a WCF parameter that limits the amount of items in an object graph, this parameter has a default value of: 65,536 is this what is causing my problem? and if so is there a way in which I can alter that value in ASP.NET Web API?

Do you really need that much nodes to be returned? Maybe you should consider paging it using $top={pageSize}&$skip={pageNumber} in query. However I assume you are using [Queryable] attribute in API controller. If so you can try using MaxNodeCount property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM