正如我从谷歌搜索中了解到的那样,MSCRM 2011检索最多5000个实体,但我希望我的所有实体都来自营销列表。正如在Web上创建的,在HKLM \ Software \ Microsoft \ MSCRM上创建“TurnOffFetchThrottling”字段并将值设置为1可以解决此5000限制问题(此外,我在注册表中添加了MaxRowsPerPage字段并将其值设置为超过5000,但它也不起作用)。我试了一下,我得到了System.OutOfMemory Exception错误。顺便说一句,当我删除“”并只是获取id属性代码完美,但我需要所有属性。这是我的fetchxml代码:
enter code here
string fetchXml = "<fetch mapping='logical' >"
+ "<entity name='" + entityType.LogicalName + "'>"
+ "<all-attributes />"
+ "<link-entity name='listmember' to='" + entityType.LogicalName + "id" + "' from='entityid'>"
+ "<filter>"
+ "<condition attribute='listid' operator='eq' value='" + chosenMarketingListGuid + "'/>"
+ "</filter>"
+ "</link-entity>"
+ "</entity>"
+ "</fetch>";
我又尝试了一件事,我将fetchxml更改为:
enter code here
string fetchXml = "<fetch mapping='logical' >"
+ "<entity name='listmember'>"
+ "<all-attributes />"
+ "<filter>"
+ "<condition attribute='listid' operator='eq' value='" + chosenMarketingListGuid + "'/>"
+ "</filter>"
+ "</entity>"
+ "</fetch>";
如图所示,我尝试仅检索成员列表而不是联系人/主管/帐户enttiy类型,并且它有效!我需要联系人/主管/账户实体类型而非会员名单。 如果有人帮我走出这条黑暗的MSCRM隧道,我将非常感激!
这里,完整堆栈跟踪:
[OutOfMemoryException:抛出了'System.OutOfMemoryException'类型的异常。 System.ServiceModel.Security.SecurityUtils.ReadContentAsBase64(XmlDictionaryReader reader,Int64 maxBufferSize)+197 System.ServiceModel.Security.EncryptedData.ReadCipherData(XmlDictionaryReader reader,Int64 maxBufferSize)+17 System.ServiceModel.Security.EncryptedType.ReadFrom(XmlDictionaryReader reader,Int64 maxBufferSize)+858 System.ServiceModel.Security.WSSecurityOneDotZeroReceiveSecurityHeader.DecryptBody(XmlDictionaryReader bodyContentReader,SecurityToken令牌)+80 System.ServiceModel.Security.WSSecurityOneDotZeroReceiveSecurityHeader.ExecuteMessageProtectionPass(Boolean hasAtLeastOneSupportingTokenExpectedToBeSigned)+1611 System.ServiceModel.Security.ReceiveSecurityHeader.Process(TimeSpan timeout,ChannelBinding channelBinding,ExtendedProtectionPolicy extendedProtectionPolicy)+1576 System.ServiceModel.Security.MessageSecurityProtocol.ProcessSecurityHeader(ReceiveSecurityHeader securityHeader,Message&amp; message,SecurityToken requiredSigningToken,TimeSpan timeout,SecurityProtocolCorrelationState [] correlationStates)+205 System.ServiceModel.Security.SymmetricSecurityProtocol.VerifyIncomingMessageCore(Message&amp; message,String actor,TimeSpan timeout,SecurityProtocolCorrelationState [] correlationStates)+637 System.ServiceModel.Security.MessageSecurityProtocol.VerifyIncomingMessage(消息和消息,TimeSpan超时,SecurityProtocolCorrelationState [] correlationStates)+371 System.ServiceModel.Channels.SecurityRequestChannel.ProcessReply(消息回复,SecurityProtocolCorrelationState correlationState,TimeSpan超时)+471 System.ServiceModel.Channels.SecurityRequestChannel.Request(消息消息,TimeSpan超时)+175 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时)+22 System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Object [] ins,Object [] outs,TimeSpan timeout)+517 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime operation)+88 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)+453 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData,Int32 type)+237 Microsoft.Xrm.Sdk.IOrganizationService.RetrieveMultiple(QueryBase query)+0 Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultipleCore(QueryBase query)+626 Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultiple(QueryBase query)+39 在C:\ Users \ Zafer \ Documents \ Visual Studio 2010 \ Projects \ IMPlugin \ MarketingListHelper.cs中的IMPlugin.MarketingListHelper.getMembersAndCountOfChosenMarketingList(OrganizationServiceProxy服务,Guid selectedMarketingListGuid,Entity entityType):130 C:\ Users \ Zafer \ Documents \ Visual Studio 2010 \ Projects \ IMPlugin \ IM_SMS.aspx.cs中的IMPlugin.IM_SMS.fillMainPanel(Double mainPanelHeight):96 C:\ Users \ Zafer \ Documents \ Visual Studio 2010 \ Projects \ IMPlugin \ IM_SMS.aspx.cs中的IMPlugin.IM_SMS.Page_Load(Object sender,EventArgs e):42 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,Object o,Object t,EventArgs e)+14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,EventArgs e)+35 System.Web.UI.Control.OnLoad(EventArgs e)+91 System.Web.UI.Control.LoadRecursive()+ 74 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)+2207
答案 0 :(得分:5)
存在5000限制的原因是作为一个粗略的障碍来防止您遇到的问题。你已经绕过了软件限制,你现在需要克服硬件限制(内存不足)......
您没有说明您是如何编写代码或使用结果的,但我认为在执行查询后会有其他处理。在此基础上,我的建议是将分页引入查询表达式并以5000的批量处理记录。
一个粗略的例子:
// get records to process
string pagingCookie = null;
bool moreRecords = false;
int pageNum = 1;
DataCollection<Entity> myBatchOfRecords;
bool continueProcessing = true;
while (continueProcessing)
{
myBatchOfRecords = GetRecords(pageNum, ref pagingCookie, ref moreRecords);
// process those records
ProcessRecords(myBatchOfRecords);
pageNum++;
continueProcessing = moreRecords;
}
function DataCollection<Entity> GetRecordsList(int pageNumber, ref string pagingCookie, ref bool moreRecords){
var query = new QueryExpression(blahblahblah...);
query.PageInfo = new PagingInfo {
Count = 5000,
PageNumber = pageNumber,
PagingCookie = pagingCookie };
var results = myOrgService.RetrieveMultiple(query);
pagingCookie = matchedContacts.PagingCookie;
moreRecords = matchedContacts.MoreRecords;
return results;
}