获取splistitemcollection时使服务器内存不足 [英] get Server Out Of Memory when getting splistitemcollection

查看:104
本文介绍了获取splistitemcollection时使服务器内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的库中有超过600000个文件,当我尝试获取splistitemcollection时出现服务器内存不足异常.

my library has over 600000 files and i got Server Out Of Memory exception when i trying to get splistitemcollection.

错误消息:

服务器内存不足.

服务器上没有内存可以运行您的程序.遇到此问题,请与您的管理员联系.< nativehr> 0x8007000e</nativehr>< nativestack></nativestack>

Server Out Of Memory.

There is no memory on the server to run your program. Please contact your administrator with this problem.<nativehr>0x8007000e</nativehr><nativestack></nativestack>

获取splistitemcollection有什么限制?

any limitation of getting splistitemcollection?

推荐答案

作为一种解决方法,我们可以从某个视图获取该集合.

As a workaround, we can get the collection from a certain view.

SPWeb web = site.OpenWeb();
SPList list = web.Lists["Shared Documents"];
//Getting only the view items - could be empty
SPListItemCollection itemCol = list.GetItems("FakeView");

http://rotemoss.blogspot.sg/2009/08/memory-problem-using .html

或者我们可以将SPQuery与ListItemCollectionPosition一起使用来批量获取列表项.

Or we can use SPQuery with ListItemCollectionPosition to get list items batch.

SPQuery query = new SPQuery();
query.RowLimit = 100; // we want to retrieve 100 items

query.ListItemCollectionPosition = prevItems.ListItemCollectionPosition; // starting at a previous position
SPListItemCollection items = SPContext.Current.List.GetItems(query);
// now iterate through the items collection

https://msdn.microsoft.com/en -us/library/microsoft.sharepoint.spquery.listitemcollectionposition.aspx?f = 255& MSPPError = -2147217396

最好的问候,

丹尼斯


这篇关于获取splistitemcollection时使服务器内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆