Introduction:
Recently we had a business requirement where we created plug-ins and asynchronous workflows for ON-Premise CRM and in the plug-ins, we used some third party dll like Newtonsoft.Json.dll. But when we tried to register the plug-ins using ILMerge approach, the third party dlls did not get merged with plugin dll and other required dlls. So we have no option other than registering the plugins on “Disk” Mode.
However, it was working fine in Dev environment.
Also, when we moved it to the Production following the same steps as we did for Dev, the plug-ins were working fine when they were triggered on their respective events. But when Asynchronous workflows on the same entity (as of Plugins) were fired it started failing with error as shown in the below screenshot.
At first, we were not able to understand the reason why such error was occurring in the workflow as we correctly registered all plugins and it was working fine on individual events of the plugins like an update of an entity.
Then after some research and play around we found that the only difference was that the Production environment was distributed to multiple servers i.e. Dynamics CRM was installed on one server and SQL in other. So was their Frontend server and Backend servers which were hosted on different machines.
Whereas in Dev environment, all the services were installed on one machine where the CRM was installed. Also, the plugins were registered on disk there too. So for Dev CRM, we had copied our Plug-in dll file and other dependent .dll files in the following path below
C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly
on the machine where CRM was installed and as well as CRM services were running and SQL Server was present.
So during deployment to PROD, we copied our .dll files in the same path of the machine which was Application server where ONLY CRM was installed. And as mentioned earlier, due to the distributed server setup, their SQL server was at one machine and CRM services were running at Back End Server machine. At first, we only copied our dll files in Application server machine in the same path as above and registered the plug-ins and its steps in Application server machine.
But we faced the issue from asynchronous workflows in Production Environment as explained above.
Later after some research, we found that as CRM is distributed on multiple servers so we will need to copy the dlls in Back End Server machine too where CRM services were running. So we first copied dll files to the path mentioned above in the machine where CRM is installed, which is Application Server. And then repeated the same task as above i.e copied the plug-in dll and dependent other dlls in the path of the machine where CRM services are present, which is Back End Server in our case. And then we registered the plug-in the CRM installed machine.
Woah! It worked and resolved our issue.
If you try to copy the dlls in the CRM services installed machine AFTER registering the plugin, then the issue will still be there. In such cases, you may need to do an IISRESET
(Note: I didn’t do it as it was a Production environment)
So the safe option is to make sure you copy dlls in both servers first and then register plug-in.
NOTE: If there’s no “assembly” folder in the bin folder of Server folder of Microsoft Dynamics CRM in the machine were CRM services are installed, then create one and copy dlls.
Hope this Helps!
70% of global 2000 companies apply gamification to improve productivity and returns!
Gamifics365 – Spin the magic of games within Microsoft Dynamics 365 CRM to improve user adoption, enhance productivity, and achieve company goals!