我正在尝试将插件部署到内部部署的Dynamics CRM 2011.该插件不执行任何操作,它只是附加在{{1}的Post-Process事件上的空Execute
方法实体。
我的插件看起来像这样:
Account
插件注册正常;这是注册屏幕的样子:
当我创建新帐户时,收到以下错误:
namespace CrmDemo.Plugins
{
public class PostAccountCreateDetail: IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
}
}
}
以下是错误日志:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetailDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail</Message>
<Timestamp>2014-08-14T15:29:09.9661308Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText>
[CrmDemo.Plugins: CrmDemo.Plugins.PostAccountCreateDetail]
[3e3c27ae-c723-e411-bdf4-00155d1e0a3f: CrmDemo.Plugins.PostAccountCreateDetail: Create of account]
</TraceText>
</OrganizationServiceFault>
查看DotPeek中的CrmDemo.Plugins.dll文件,我可以清楚地看到[2014-08-14 14:11:31.100] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread: 22 |Category: Exception |User: 6abf3aac-971d-e411-aded-00155d1e0a3f |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | CrmException..ctor ilOffset = 0x7
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException) ilOffset = 0x7
at CrmException..ctor(String message, Exception innerException, Int32 errorCode) ilOffset = 0x5
at ExceptionConverter.TryConvertToCrmExceptionInternal(Exception exception, CrmException& crmException) ilOffset = 0x81
at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException) ilOffset = 0xAE
at SandboxCodeUnit.Execute(IExecutionContext context) ilOffset = 0x116
at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context) ilOffset = 0xE5
at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) ilOffset = 0x65
at Pipeline.Execute(PipelineExecutionContext context) ilOffset = 0x65
at MessageProcessor.Execute(PipelineExecutionContext context) ilOffset = 0x1FB
at InternalMessageDispatcher.Execute(PipelineExecutionContext context) ilOffset = 0xE4
at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext) ilOffset = 0x0
at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context) ilOffset = 0xB4
at BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context) ilOffset = 0x4E
at AccountService.Create(IBusinessEntity entity, ExecutionContext context) ilOffset = 0xB
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) ilOffset = 0xFFFFFFFF
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) ilOffset = 0x25
at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) ilOffset = 0x89
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 = 0x3D
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 CreateCommand.Execute() ilOffset = 0xC
at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId) ilOffset = 0x0
at EntityProxy.Create(Boolean performDuplicateCheck) ilOffset = 0x7
at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck) ilOffset = 0x28
at AppForm.FormSaveAndCloseEvent() ilOffset = 0x18
at AppForm.RaiseDataEvent(FormEventId eventId) ilOffset = 0xD7
at EndUserForm.Initialize(Entity entity) ilOffset = 0x1F
at CustomizableForm.Execute(Entity entity, FormDescriptor fd) ilOffset = 0x62
at AccountRecordPageHandler.ConfigureFormHandler() ilOffset = 0x56
at RecordPageHandler.ConfigureFormWrapper() ilOffset = 0xC
at GenericEventProcessor.RaiseEvent(String eventName) ilOffset = 0x2D
at PageManager.OnPreRender(EventArgs e) ilOffset = 0x47
at Control.PreRenderRecursiveInternal() ilOffset = 0x54
at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x6D3
at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x3C
at Page.ProcessRequest() ilOffset = 0x14
at Page.ProcessRequest(HttpContext context) ilOffset = 0x33
at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() ilOffset = 0x18D
at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ilOffset = 0x15
at ApplicationStepManager.ResumeSteps(Exception error) ilOffset = 0x10A
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) ilOffset = 0x5C
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) ilOffset = 0x16A
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType) ilOffset = 0x4B
>Crm Exception: Message: Assembly should be provided, ErrorCode: -2147204719
[2014-08-14 14:11:35.029] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 22 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | CrmException..ctor ilOffset = 0x7
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException) ilOffset = 0x7
at CrmException..ctor(String message, Exception innerException, Int32 errorCode) ilOffset = 0x5
at ExceptionConverter.TryConvertToCrmExceptionInternal(Exception exception, CrmException& crmException) ilOffset = 0x81
at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException) ilOffset = 0xAE
at SandboxCodeUnit.Execute(IExecutionContext context) ilOffset = 0x116
at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context) ilOffset = 0xE5
at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) ilOffset = 0x65
at Pipeline.Execute(PipelineExecutionContext context) ilOffset = 0x65
at MessageProcessor.Execute(PipelineExecutionContext context) ilOffset = 0x1FB
at InternalMessageDispatcher.Execute(PipelineExecutionContext context) ilOffset = 0xE4
at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext) ilOffset = 0x0
at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context) ilOffset = 0xB4
at BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context) ilOffset = 0x4E
at AccountService.Create(IBusinessEntity entity, ExecutionContext context) ilOffset = 0xB
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) ilOffset = 0xFFFFFFFF
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) ilOffset = 0x25
at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) ilOffset = 0x89
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 = 0x3D
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 CreateCommand.Execute() ilOffset = 0xC
at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId) ilOffset = 0x0
at EntityProxy.Create(Boolean performDuplicateCheck) ilOffset = 0x7
at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck) ilOffset = 0x28
at AppForm.FormSaveAndCloseEvent() ilOffset = 0x18
at AppForm.RaiseDataEvent(FormEventId eventId) ilOffset = 0xD7
at EndUserForm.Initialize(Entity entity) ilOffset = 0x1F
at CustomizableForm.Execute(Entity entity, FormDescriptor fd) ilOffset = 0x62
at AccountRecordPageHandler.ConfigureFormHandler() ilOffset = 0x56
at RecordPageHandler.ConfigureFormWrapper() ilOffset = 0xC
at GenericEventProcessor.RaiseEvent(String eventName) ilOffset = 0x2D
at PageManager.OnPreRender(EventArgs e) ilOffset = 0x47
at Control.PreRenderRecursiveInternal() ilOffset = 0x54
at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x6D3
at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x3C
at Page.ProcessRequest() ilOffset = 0x14
at Page.ProcessRequest(HttpContext context) ilOffset = 0x33
at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() ilOffset = 0x18D
at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ilOffset = 0x15
at ApplicationStepManager.ResumeSteps(Exception error) ilOffset = 0x10A
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) ilOffset = 0x5C
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) ilOffset = 0x16A
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType) ilOffset = 0x4B
>Crm Exception: Message: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail, ErrorCode: -2147220970
[2014-08-14 14:11:35.031] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread: 22 |Category: Sandbox |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | SandboxCodeUnit.Execute ilOffset = 0x116
>Execute: CrmException: CrmDemo.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a1e5ef8c26cb80d2; 80040216; System.ArgumentNullException: Value cannot be null.
>Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail
[2014-08-14 14:11:35.032] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread: 22 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | MessageProcessor.Execute ilOffset = 0x1FB
>MessageProcessor fail to process message 'Create' for 'account'.
[2014-08-14 14:11:35.034] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread: 22 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | MessageProcessor.Execute ilOffset = 0x1C5
>MessageProcessor fail to process message 'Create' for 'account'.
[2014-08-14 14:11:35.035] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 22 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | CrmException..ctor ilOffset = 0x7
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException) ilOffset = 0x7
at CrmException..ctor(String message, Int32 errorCode) ilOffset = 0x5
at PlatformCommand.CreateCrmExceptionFromServiceFault(FaultException`1 fe) ilOffset = 0x1B
at PlatformCommand.XrmExecuteInternal() ilOffset = 0xF6
at CreateCommand.Execute() ilOffset = 0xC
at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId) ilOffset = 0x0
at EntityProxy.Create(Boolean performDuplicateCheck) ilOffset = 0x7
at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck) ilOffset = 0x28
at AppForm.FormSaveAndCloseEvent() ilOffset = 0x18
at AppForm.RaiseDataEvent(FormEventId eventId) ilOffset = 0xD7
at EndUserForm.Initialize(Entity entity) ilOffset = 0x1F
at CustomizableForm.Execute(Entity entity, FormDescriptor fd) ilOffset = 0x62
at AccountRecordPageHandler.ConfigureFormHandler() ilOffset = 0x56
at RecordPageHandler.ConfigureFormWrapper() ilOffset = 0xC
at GenericEventProcessor.RaiseEvent(String eventName) ilOffset = 0x2D
at PageManager.OnPreRender(EventArgs e) ilOffset = 0x47
at Control.PreRenderRecursiveInternal() ilOffset = 0x54
at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x6D3
at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x3C
at Page.ProcessRequest() ilOffset = 0x14
at Page.ProcessRequest(HttpContext context) ilOffset = 0x33
at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() ilOffset = 0x18D
at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ilOffset = 0x15
at ApplicationStepManager.ResumeSteps(Exception error) ilOffset = 0x10A
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) ilOffset = 0x5C
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) ilOffset = 0x16A
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType) ilOffset = 0x4B
>Crm Exception: Message: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail, ErrorCode: -2147220970
[2014-08-14 14:11:35.037] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread: 22 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | ErrorInformation.LogError ilOffset = 0x17
>MSCRM Error Report:
--------------------------------------------------------------------------------------------------------
Error: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail
Error Number: 0x80040216
Error Message: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail
Error Details: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail
Source File: Not available
Line Number: Not available
Request URL: http://localhost/MartinandAssociates/userdefined/edit.aspx?etc=1&pagemode=iframe
Stack Trace Info: [CrmException: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail]
at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
at Microsoft.Crm.Application.Platform.ServiceCommands.CreateCommand.Execute()
at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)
at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck)
at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)
类,所以我不确定为什么CRM说它无法找到它。
答案 0 :(得分:2)
这可能是您包含的dll版本的问题...
检查(Microsoft.Xrm.Sdk和Microsoft.Crm.Sdk)版本是5.0.0.0还是6.0.0.0?
看起来CRM还没有它们在GAC中