在MetadataCache中找不到名称为“RecordCountSnapshot”的实体

时间:2013-08-02 11:21:12

标签: deployment dynamics-crm-2011 dynamics-crm

我们最近将CRM(UR13)的更新部署为我们开发环境中的非托管解决方案。由于某些未知原因,这会从帐户实体上的3个OptionSet字段中删除自定义项,导致5天后注意到数据损坏= /。

无论如何,我愿意为时间做一个异常,我只是为了背景而提出来。要解决此问题,重新导入非托管解决方案(包括帐户实体)应重建这些OptionSet。我创建了两个测试环境,一个是在部署非托管解决方案之前来自Live备份,另一个是代表它当前状态。

将相同的解决方案包导入测试环境现在会导致抛出The entity with a name = 'RecordCountSnapshot' was not found in the MetadataCache.错误。这引发了一些问题,比如我是如何设法首先将解决方案导入Live环境的?这不是全部,似乎部署到这些环境的大多数任何解决方案都会抛出相同的错误,使维修/未来的定制看似不可能!

RecordCountSnapshot隐藏实体作为所有SQL数据库中的表存在,并存在于我执行的元数据查询中。 This forum post是我在这个问题上找到的问题唯一有用的参考,但遗憾的是没有解决。

如果有人能够提供可能有助于解决此问题的最小洞察力,我将非常感谢XD。


修改

@Daryl要求的W3WP跟踪文件 - 如果您需要更多信息,请告诉我。

仅供参考我手动运行此跟踪中提到的查询,并且返回346结果没有问题

>Query execution time: 0.0 seconds; database: Organisation_MSCRM_220713_2330; Server:PY3-CRMTEST; command: select 
"recordcountsnapshot0".ObjectTypeCode as "objecttypecode"
, "recordcountsnapshot0".Count as "count"
, "recordcountsnapshot0".RecordCountSnapshotId as "recordcountsnapshotid" 
from
 RecordCountSnapshot as "recordcountsnapshot0" (NOLOCK) .
[2013-07-31 16:24:53.614] Process: w3wp |Organization:2c22b814-38f9-e211-8151-00155d143602 |Thread:   14 |Category: Exception |User: 9b39cd7c-231c-4c66-9459-327009bcb0ef |Level: Error |ReqId: a0ac1144-4cce-43b1-bc27-08484d9a73bc | CrmException..ctor  ilOffset = 0x0
    at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x0
    at CrmException..ctor(String message, Int32 errorCode)  ilOffset = 0x0
    at DynamicMetadataCache.GetEntity(String entityName, NameMappingType mapping)  ilOffset = 0x13
    at BusinessEntityCollection.get_EntityMetadata()  ilOffset = 0x37
    at BusinessProcessObject.FillEntityCollectionFromDataReader(BusinessEntityCollection entities, IDataReader reader, EntityExpression entityExp, Boolean useEntityExpression, String aggregateLimitExceededName, Boolean quickFindRecordLimitCheckRequired, ExecutionContext context)  ilOffset = 0x70
    at BusinessProcessObject.QueryAndFillEntityCollection(CrmDbConnection dbConnection, IDbCommand dbCommand, BusinessEntityCollection entities, EntityExpression entityExp, PagingHelper pagingHelper, Boolean useEntityExpression, String aggregateLimitExceededName, ExecutionContext context)  ilOffset = 0x4D
    at BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, PagingHelper pagingHelper, ExecutionContext context)  ilOffset = 0x41
    at BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, ExecutionContext context)  ilOffset = 0x40
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, DatabaseQueryTarget queryTarget, ExecutionContext context)  ilOffset = 0x76
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)  ilOffset = 0x0
    at RecordCountCacheLoader.LoadCacheData(Guid key, ExecutionContext context)  ilOffset = 0x62
    at ObjectModelCacheLoader`2.LoadCacheData(TKey key, IOrganizationContext context)  ilOffset = 0x25
    at CrmMultiOrgCacheBase`2.CreateEntry(TKey key, IOrganizationContext context)  ilOffset = 0x0
    at CrmMultiOrgCacheBase`2.LookupEntry(TKey key, IOrganizationContext context)  ilOffset = 0x26
    at RecordCountCache.RetrieveRecordCount(Int32 objectTypeCode, IOrganizationContext context)  ilOffset = 0x7
    at SecurityExtensionRetrieveMultipleHelper.GetRetrieveMultipleSecurityFilterOption(RetrieveMultipleSecurityFilterPopulatorInitializationData initializationData, ExecutionContext context)  ilOffset = 0x7A
    at SecurityExtension.CreateSecurityFilter(Guid user, EntityMetadata entityMetadata, FilterExpression existingCriteria, ExecutionContext context, Boolean noLock, LinkEntityType linkEntityType, RetrieveMultipleSecuritySqlFormat& securitySqlFormat)  ilOffset = 0x3E
    at SecurityExtension.AddSecuritySql(Guid user, EntityExpression entityExpression, ExecutionContext context)  ilOffset = 0x28
    at SecurityExtension.PreRetrieveMultipleHandler(ExtensionEventArgs e)  ilOffset = 0x19
    at PreRetrieveMultipleEventHandler.Invoke(Object sender, ExtensionEventArgs e)  ilOffset = 0xFFFFFFFF
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, DatabaseQueryTarget queryTarget, ExecutionContext context)  ilOffset = 0x5F
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)  ilOffset = 0x0
    at ImportSolutionConfigurationPageHandler.ImportItem()  ilOffset = 0x60
    at ImportHandler.Import()  ilOffset = 0x43
    at RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)  ilOffset = 0x7
    at RootImportHandler.HandleNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath)  ilOffset = 0x33
    at RootImportHandler.RunImport(String[] ImportEntities)  ilOffset = 0x1D8
    at ImportXml.RunImport(String[] ImportEntities)  ilOffset = 0xE
    at ImportXml.RunImport()  ilOffset = 0x5B3
    at ImportXmlService.ImportSolutionSkipCapable(Boolean overwriteUnmanagedCustomizations, Boolean publishWorkflows, Byte[] customizationFile, Guid importJobId, Boolean convertToManaged, Boolean skipProductUpdateDependencies, ExecutionContext context)  ilOffset = 0x46
    at RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)  ilOffset = 0xFFFFFFFF
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)  ilOffset = 0x101
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x0
    at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
    at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x50
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at ImportSolutionCommand.Execute()  ilOffset = 0x20
    at DataSource.ImportSolution(Byte[] customizationFile, Boolean overwriteUnmanagedCustomizations, Boolean publishWorkflows, Guid importJobId, Boolean convertToManaged, Boolean skipProductUpdateDependencies, IOrganizationContext context)  ilOffset = 0x0
    at SolutionImportProcessPage.ImportSolution()  ilOffset = 0x11E
    at SolutionImportProcessPage.ProcessRequestData()  ilOffset = 0x4A
    at SolutionImportProcessPage.ProcessAction(String action)  ilOffset = 0x92
    at AppUIPage.OnPreRender(EventArgs e)  ilOffset = 0xD
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>Crm Exception: Message: The entity with a name = 'RecordCountSnapshot' was not found in the MetadataCache., ErrorCode: -2147217150
[2013-07-31 16:24:53.614] Process: w3wp |Organization:2c22b814-38f9-e211-8151-00155d143602 |Thread:   14 |Category: Platform.Sql |User: 9b39cd7c-231c-4c66-9459-327009bcb0ef |Level: Error |ReqId: a0ac1144-4cce-43b1-bc27-08484d9a73bc | BusinessProcessObject.DoRetrieveMultiple  ilOffset = 0x41
    at BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, PagingHelper pagingHelper, ExecutionContext context)  ilOffset = 0x41
    at BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, ExecutionContext context)  ilOffset = 0x40
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, DatabaseQueryTarget queryTarget, ExecutionContext context)  ilOffset = 0x76
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)  ilOffset = 0x0
    at RecordCountCacheLoader.LoadCacheData(Guid key, ExecutionContext context)  ilOffset = 0x62
    at ObjectModelCacheLoader`2.LoadCacheData(TKey key, IOrganizationContext context)  ilOffset = 0x25
    at CrmMultiOrgCacheBase`2.CreateEntry(TKey key, IOrganizationContext context)  ilOffset = 0x0
    at CrmMultiOrgCacheBase`2.LookupEntry(TKey key, IOrganizationContext context)  ilOffset = 0x26
    at RecordCountCache.RetrieveRecordCount(Int32 objectTypeCode, IOrganizationContext context)  ilOffset = 0x7
    at SecurityExtensionRetrieveMultipleHelper.GetRetrieveMultipleSecurityFilterOption(RetrieveMultipleSecurityFilterPopulatorInitializationData initializationData, ExecutionContext context)  ilOffset = 0x7A
    at SecurityExtension.CreateSecurityFilter(Guid user, EntityMetadata entityMetadata, FilterExpression existingCriteria, ExecutionContext context, Boolean noLock, LinkEntityType linkEntityType, RetrieveMultipleSecuritySqlFormat& securitySqlFormat)  ilOffset = 0x3E
    at SecurityExtension.AddSecuritySql(Guid user, EntityExpression entityExpression, ExecutionContext context)  ilOffset = 0x28
    at SecurityExtension.PreRetrieveMultipleHandler(ExtensionEventArgs e)  ilOffset = 0x19
    at PreRetrieveMultipleEventHandler.Invoke(Object sender, ExtensionEventArgs e)  ilOffset = 0xFFFFFFFF
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, DatabaseQueryTarget queryTarget, ExecutionContext context)  ilOffset = 0x5F
    at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)  ilOffset = 0x0
    at ImportSolutionConfigurationPageHandler.ImportItem()  ilOffset = 0x60
    at ImportHandler.Import()  ilOffset = 0x43
    at RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)  ilOffset = 0x7
    at RootImportHandler.HandleNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath)  ilOffset = 0x33
    at RootImportHandler.RunImport(String[] ImportEntities)  ilOffset = 0x1D8
    at ImportXml.RunImport(String[] ImportEntities)  ilOffset = 0xE
    at ImportXml.RunImport()  ilOffset = 0x5B3
    at ImportXmlService.ImportSolutionSkipCapable(Boolean overwriteUnmanagedCustomizations, Boolean publishWorkflows, Byte[] customizationFile, Guid importJobId, Boolean convertToManaged, Boolean skipProductUpdateDependencies, ExecutionContext context)  ilOffset = 0x46
    at RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)  ilOffset = 0xFFFFFFFF
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)  ilOffset = 0x101
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x0
    at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
    at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x50
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at ImportSolutionCommand.Execute()  ilOffset = 0x20
    at DataSource.ImportSolution(Byte[] customizationFile, Boolean overwriteUnmanagedCustomizations, Boolean publishWorkflows, Guid importJobId, Boolean convertToManaged, Boolean skipProductUpdateDependencies, IOrganizationContext context)  ilOffset = 0x0
    at SolutionImportProcessPage.ImportSolution()  ilOffset = 0x11E
    at SolutionImportProcessPage.ProcessRequestData()  ilOffset = 0x4A
    at SolutionImportProcessPage.ProcessAction(String action)  ilOffset = 0x92
    at AppUIPage.OnPreRender(EventArgs e)  ilOffset = 0xD
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>Exception when executing query: select 
"recordcountsnapshot0".ObjectTypeCode as "objecttypecode"
, "recordcountsnapshot0".Count as "count"
, "recordcountsnapshot0".RecordCountSnapshotId as "recordcountsnapshotid" 
from
 RecordCountSnapshot as "recordcountsnapshot0" (NOLOCK)  Exception: Microsoft.Crm.Metadata.EntityMetadataNotFoundException: The entity with a name = 'RecordCountSnapshot' was not found in the MetadataCache.
   at Microsoft.Crm.Metadata.DynamicMetadataCache.GetEntity(String entityName, NameMappingType mapping)
   at Microsoft.Crm.BusinessEntities.BusinessEntityCollection.get_EntityMetadata()
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.FillEntityCollectionFromDataReader(BusinessEntityCollection entities, IDataReader reader, EntityExpression entityExp, Boolean useEntityExpression, String aggregateLimitExceededName, Boolean quickFindRecordLimitCheckRequired, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.QueryAndFillEntityCollection(CrmDbConnection dbConnection, IDbCommand dbCommand, BusinessEntityCollection entities, EntityExpression entityExp, PagingHelper pagingHelper, Boolean useEntityExpression, String aggregateLimitExceededName, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, PagingHelper pagingHelper, ExecutionContext context)

1 个答案:

答案 0 :(得分:0)

通过升级到RU14进行修复,我列出了upgrade documentation中所有可能相关的修复,但它们似乎都没有与我看到的问题相符,但它可能是复合效应。就个人而言,我认为这个问题更有可能是由升级后隐式修复的某些文件损坏引起的。

  • 导入文本数据时,会出现“SecLib :: CheckPrivilege”错误。
  • 在Microsoft Dynamics CRM中导入托管解决方案后,解决方案表单上的标签显示错误信息。
  • 假设数据导入操作对非默认组织中的某些记录失败。当您尝试导出失败历史记录时,您会收到一条错误消息,指出该记录不可用。