2

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

反正我愿意暂时放下一个异常,我只是把它作为背景。要解决此问题,重新导入非托管解决方案(包括帐户实体)应重建这些选项集。我创建了 2 个测试环境,一个来自部署非托管解决方案之前的实时备份,另一个代表它的当前状态。

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

RecordCountSnapshot隐藏实体在所有 SQL 数据库中都以表的形式出现,并且出现在我执行的元数据查询中。这个论坛帖子是我在这个问题上找到的唯一有用的参考,但遗憾的是它没有得到解决。

如果有人可以提供可能有助于解决此问题的最小见解,我将非常感激 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)
4

1 回答 1

0

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

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