开发者

Exception in returning Generic List from WCF

Hi I am stuck in strange issue,

I have an Generic list List<Accounts> it is po开发者_StackOverflow社区pulated from database, then this list is returning to client.

When list contains more than 3000 items it is throwing exception.

I have set following values in web.config

maxDepth="2147483647" 
maxStringContentLength="2147483647" 
maxArrayLength="2147483647" 
maxBytesPerRead="2147483647" 
maxNameTableCharCount="2147483647" 


As Kirk mentioned, try add a behavior to your config similar to below:

<behaviors>
<endpointBehaviors>
<behavior name="MyService.MyServiceBehavior">
 <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>

If this works for you then don't mark me as correct, Kirk you add an answer and I will remove this one


Here are some solutions you could try:

  • There’s a good chance you could be hitting a timeout issue. Try to set the timeouts on your binding both on the client and the server to something higher than 1 minute (which is the default).
  • Increase maxItemsInObjectGraph in DataContractBehavior.

Otherwise, edit your question to include information about the exception you’re getting and any other information that may be relevant.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜