将CRM 2013本地升级到CRM365后,插件问题开始出现。每次我尝试从插件使用IOrganizationService进行任何操作时都会出错。 此问题仅在多服务器安装时出现,它在CRM 2013版本上没有出现。它也不会出现在CRM365的单服务器安装上。
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #52BFF7F3Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>c291f3ee-3bfe-4c0d-a631-9b7e70c19add</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #52BFF7F3</Message>
<Timestamp>2017-03-13T12:14:25.2768854Z</Timestamp>
<ExceptionSource i:nil="true" />
<InnerFault>
<ActivityId>c291f3ee-3bfe-4c0d-a631-9b7e70c19add</ActivityId>
<ErrorCode>-2147220891</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>callManagerInfo</Message>
<Timestamp>2017-03-13T12:14:25.2768854Z</Timestamp>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText>
[PluginsMerged: Core.Plugins.ReadAuditLogPlugin]
[b381844a-41b5-e611-b605-0050568c2255: Core.Plugins.ReadAuditLogPlugin: RetrieveMultiple of account]
Entered Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Core.Plugins.ReadAuditLogPlugin is firing for Entity: account, Message: RetrieveMultiple, Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered internal execute in ReadAuditLogService., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
EnsureInitialized., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetMessage., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetUserFromPlugin., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
user 21391658-381b-e511-80e0-005056931145., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Before context.OrganizationService.Retrieve., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
callManagerInfo, Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Exiting Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
</TraceText>
</InnerFault>
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
抛出此异常的代码是:
private User GetUserFromPlugin(ILocalPluginContext context)
{
context.Trace("Entered GetUserFromPlugin.");
var userId = context.PluginExecutionContext.UserId;
context.Trace(string.Format("user {0}.", userId));
context.Trace("Before context.OrganizationService.Retrieve.");
if (context.OrganizationService == null)
{
var organizationServiceNullMessage = "OrganizationService is null";
context.Trace(organizationServiceNullMessage);
throw new InvalidPluginExecutionException(organizationServiceNullMessage);
}
var systemUser = context.OrganizationService.Retrieve(
EntityNames.CRMSystemUser,
userId,
new ColumnSet(FieldNames.CRMSystemUser.DomainName, FieldNames.CRMSystemUser.LastName, FieldNames.CRMSystemUser.FirstName));
context.Trace("After context.OrganizationService.Retrieve.");
var user = new User
{
Id = userId,
DomainName = systemUser.ReadAttributeValue<string>(FieldNames.CRMSystemUser.DomainName),
FirstName = systemUser.ReadAttributeValue<string>(FieldNames.CRMSystemUser.FirstName),
LastName = systemUser.ReadAttributeValue<string>(FieldNames.CRMSystemUser.LastName),
};
return user;
}
--------- EDIT ----------------
我正在添加插件追踪信息
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: callManagerInfoDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>dbe29fd8-651c-47d2-ad39-ed460552d4e1</ActivityId>
<ErrorCode>-2147220891</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>OperationStatus</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">0</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>SubErrorCode</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">-2146233088</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>callManagerInfo</Message>
<Timestamp>2017-03-14T06:09:08.1648164Z</Timestamp>
<ExceptionSource>PluginExecution</ExceptionSource>
<InnerFault i:nil="true" />
<OriginalException>Microsoft.Xrm.Sdk.InvalidPluginExecutionException
at Core.Plugins.BusinessLogic.Service.ReadAuditLogService.Execute(ILocalPluginContext context)
at Core.Plugins.ReadAuditLogPlugin.InternalExecute(LocalPluginContext context)
at Plugins.Common.PluginBase.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.<>c__DisplayClass5.<Execute>b__0()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext)
at Microsoft.Crm.Sandbox.SandboxWorker.Execute(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, SandboxRequestCounter& workerCounter, Boolean returnTraceInfo)</OriginalException>
<TraceText>
Entered Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Core.Plugins.ReadAuditLogPlugin is firing for Entity: account, Message: RetrieveMultiple, Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered internal execute in ReadAuditLogService., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
EnsureInitialized., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetMessage., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetUserFromPlugin., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
user 21391658-381b-e511-80e0-005056931145., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Before context.OrganizationService.Retrieve., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
callManagerInfo, Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Exiting Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
</TraceText>
</OrganizationServiceFault>
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Crm.Sandbox.ISandboxHost.ExecuteAndReturnTraceInfo(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxPlugin.Execute(SandboxClient client, SandboxCallTracker callTracker, IExecutionContext requestContext, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
答案 0 :(得分:7)
Workaround has been provided to us by Microsoft. To stop error set the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSCRMSandboxService\SingleBox DWord value to 0. After doing that the issue It helped us with the problem.
答案 1 :(得分:0)
我们遇到了相同的问题,并通过在两个节点中添加SPN进行了修复。