zoukankan      html  css  js  c++  java
  • Plugin从Sync改为Async后报Could not load file or assembly错误

    问题:之前运行好好的一个PLUGIN,PostCreate,Synchronous

    这次想改成异步的,结果设定为Asynchronous之后,在系统作业中发现全部运行失败了,


    打开看到详细信息如下:

    Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at System.Activator.CreateInstance(Type type)
       at Microsoft.Crm.Asynchronous.VersionedProxyPluginBase.CreatePlugin[T](Type pluginType, AsyncExecutionContext context)
       at Microsoft.Crm.Asynchronous.V5ProxyPlugin..ctor(Type type, AsyncExecutionContext context, Boolean& isValid)
       at Microsoft.Crm.Asynchronous.EventOperation.InternalExecute(AsyncEvent asyncEvent)
       at Microsoft.Crm.Asynchronous.AsyncEventHandlerCommand`1.Execute(IAsyncEvent asyncEvent)
       at Microsoft.Crm.Asynchronous.AsyncEventExecutionManager`2.ExecuteCommand(IAsyncEventHandlerFactory handlerFactory)
       at Microsoft.Crm.Asynchronous.AsyncEventExecutionManager`2.ExecuteHandler(IAsyncEventHandlerFactory handlerFactory)
       at Microsoft.Crm.Asynchronous.PoolHandler.ProcessAsyncEvent(IAsyncEventExecutionManager asyncEventExecutionManager)
    Inner Exception: System.TypeInitializationException: The type initializer for '******.MSCrm.Plugins.new_******' threw an exception.
       at ******.MSCrm.Plugins.******..ctor()
    Inner Exception: System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The system cannot find the file specified.
       at ******.MSCrm.Plugins.new_******..cctor()
    

    发现是由于找不到第三方的dll【log4net.dll】造成,因为在PLUGIN当中引用了该dll写log。那为什么之前Sync的时候就可以,改成Async就不行了呢?
    原来是因为之前把log4net.dll放到了前端服务器的D:Program FilesMicrosoft Dynamics CRMCRMWebin目录下,但是如果改成Async时就应该log4net.dll放到异步服务所在的服务器的CRM安装目录下,并且详细目录和Sync稍有不同,应该放在D:Program FilesMicrosoft Dynamics CRMServerin目录下。

    备注:

    • 文件放进去之后并不会马上生效,需要重启异步服务所在的服务器
    • 异步作业读取的config文件不再是web.config,而是位于D:Program FilesMicrosoft Dynamics CRMServerin目录下的CrmAsyncService.exe.config文件
  • 相关阅读:
    OGG-01168
    浅谈webuploader上传文件
    [ IE浏览器兼容问题 ] Web Uploader 在IE、FireFox下点击上传没反应
    webuploader在ie7下的flash模式的使用
    记一次项目使用webuploader爬坑之旅
    解决Web Uploader上传文件和图片 延迟和not defined
    SpringMVC上传图片总结(2)--- 使用百度webuploader上传组件进行上传图片
    百度上传插件(webupload)单文件(单图片)上传设置
    webservice大文件怎么传输
    java使用WebUploader做大文件的分块和断点续传
  • 原文地址:https://www.cnblogs.com/cndota2/p/12097988.html
Copyright © 2011-2022 走看看