Using .NET Assembly in Microsoft Dynamics on Server as Windows Service

Question: We are using your software with Microsoft Dynamics AX 2012, and it works on the client side, but not on the server. The server is started as a Windows service, but raises at start EventId 193 saying the assembly or one of its components could not be loaded, without further details. Can you tell me what the problem may be and how to solve it?

Answer: For anything running as a Windows Service, referenced DLLs (assemblies) must be installed in the Global Assembly Cache (GAC).

 

You can install the .dll file by using the Gacutil tool or by dragging the .dll file to the appropriate folder. If you use the Gacutil tool, you can use a command that resembles the following:

gacutil -I "[DriveLetter]:\[PathWhereDllIsLocated]\ChilkatDotNet[x].dll"

To drag the file, open two instances of Windows Explorer. In one instance, find the location of the .dll file output for your console project. In the other instance, find c:\[SystemRoot]\Assembly. Then, drag your .dll file to the Assembly folder. (Such as C:\Windows\assembly)

Note: The Global Assembly Cache (GAC), when viewed using Explorer, has its view rendered in a special manner by the OS shell – you see all the assemblies, their strong name details, processor architecture and other details.

 

Also:  There are two separate GACs — one for 32-bit and one for 64-bit.   Make sure you install a 64-bit assembly in the 64-bit GAC, and a 32-bit assembly must go to the 32-bit GAC.   Search (Google) “32-bit gac vs 64-bit gac” for more information.