locked
Plugin not working through process RRS feed

  • Question

  • Hi all,

    I have written a plugin, I then deployed it to the server in the server\bin\assembly folder and crmweb\bin folder, and registered it. When I run the plugin through the ui it works fine (it is on the update of an entity), when I up date the entity it does what it is supposed to do. However we also have a process which updates the entity, thus kicking off the plugin. This fails though as it can't seem to load dependent .dlls.

    has anyone else experienced this?

    Thanks in advance

     

    Chris

    Tuesday, July 5, 2011 9:37 AM

Answers

  • Well it should work if you drop them under server\bin. (AND server\bin\assembly). However, you must restart the Async Service before you try again. If you don't restart the async service then no matter what, it will never load the plugin because of .Net class loading routines (once it fails to load an assembly it will continue to fail for the life of the process)

    Gonzalo | gonzaloruizcrm.blogspot.com

    Tuesday, July 5, 2011 3:14 PM
    Moderator

All replies

  • Hi,

    While failing is it showing any error? if your plugin is runnign Synchronous then your process step should wait untill plugin finishes execution and if plugin fails then it should your process/workflow shoudl log an exception in the System Job.

    It could be also due to worklfow/process running user security priveleges, also try to change the Plugin Run in User's Context to Administrator or Change Workflow Owner to Administrator

    I hope this resolves the issue.


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, July 5, 2011 10:30 AM
  • Hi Jehanzeb,

    It gets a could not load file or assembly error as below

    Inner Exception: System.IO.FileNotFoundException: Could not load file or assembly 'E2, Version=1.0.0.0, Culture=neutral, 

    However it has no issue with this dll when it runs through normal entity editing :-(

    the E2.dll is in the bin folders as I mentioned previously. This was showing log4net.dll before so I put it in the GACand that removed it, however I do not want to put all mt DLL's into the GAC

    I am new to CRM, how do I set the plugin to run as administrator, I cannot see this in the plugin registration tool

    Regards

    Chris

    Tuesday, July 5, 2011 11:29 AM
  • Hi,

    Try the following:

    1. Copy the assembly file into GAC assembly folder (in Run prompt, type %windir%\assembly and then drag and drop the assembly file into the GAC Assembly folder)

    2. Restart IIS service to refresh GAC assembly cache (in Command pormpt type iisreset)

    3. Try to reffer the dll in plugin from the GAC, rebuild and update plugin assembly via plugin registration tool

    *During the step registration in plugin registration tool you can change the Run in User's Context  value

     


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, July 5, 2011 12:23 PM
  • Workflows are executed by the AsyncService and have a separate way of loading plugin assemblies (so this has nothing to do with IIS).

    I have to ask the question: Why do you have reference assemblies? Reference assemblies are nothing but a pain siunce they are not fully supported and prevent you from registering your plugin in database (which has many advantages).

    If you are 100% sure that you need a reference assembly and cannot merge them then you can try to drop your reference assembly in the async server under "server\bin" directory where CrmAsyncService.exe resides or in the GAC.

    However, you should consider merging the assemblies into one and registering in database.


    Gonzalo | gonzaloruizcrm.blogspot.com


    Tuesday, July 5, 2011 1:02 PM
    Moderator
  • We need reference assemblies for the plugin to interact with our other systems. What's the point in being able to write .net plugins if they can't reference anything. We have many plugins that reference other components and they all work fine, including this one. The only issue is that it appears to be looking in the wrong place for the assembly when the workflow indirectly kicks it off

     

    :-)

    Tuesday, July 5, 2011 2:13 PM
  • Hi Jehanzeb.

    I know I can add it to the GAC and it will work, however I do not want to do this as it is a common dll for our company that is likely to change. If I put it in the GAC people will forget to update it when it is updated.

    Tuesday, July 5, 2011 2:15 PM
  • Yes Chris, I know MS is aware that they need a better story for supporting reference assemblies but as I mention, it is not fully supported right now. However, did you try to drop the assembly in the directory I mentioned?

    you can try to drop your reference assemblyin the async server under "server\bin" directory where CrmAsyncService.exe resides


    Gonzalo | gonzaloruizcrm.blogspot.com

    Tuesday, July 5, 2011 2:18 PM
    Moderator
  • Hi Gonzalo,

    server\bin\assembly is where we are dropping them, I tried the server\bin folder as you suggested, but it didn't work still :-(

    I think as you suggest the we may have to merge them

     

    regards

    Chris

    Tuesday, July 5, 2011 2:46 PM
  • Well it should work if you drop them under server\bin. (AND server\bin\assembly). However, you must restart the Async Service before you try again. If you don't restart the async service then no matter what, it will never load the plugin because of .Net class loading routines (once it fails to load an assembly it will continue to fail for the life of the process)

    Gonzalo | gonzaloruizcrm.blogspot.com

    Tuesday, July 5, 2011 3:14 PM
    Moderator
  • Wish I'd read that before I moved it to the GAC... I'll unregister from the GAC again it and see if it works :-)
    Tuesday, July 5, 2011 3:47 PM