Exception has been thrown by the target of an invocation. (mscorlib) Could not load file or assembly ‘Microsoft.Adapters.SAP.SAPGInvoker.dll’ or one of its dependencies. The specified module could not be found. (Microsoft.Adapters.SAP)

Issue Statement:
Consume adapter service for SAP binding throws an error stating exceptions has been thrown by the target of an invocation

blog117-1

Cause:
This issue is caused due to the missing SDK dll’s in the “C:\Windows\System32” and “C:\SAP Resources\rfcsdk 64\lib”  folders.

Resolution:

Make sure that you have already installed both 32 and 64 bit versions of the Microsoft BizTalk Adapter Pack.
To install missing SDK dll’s in the “C:\Windows\System32” and “C:\SAP Resources\rfcsdk 64\lib” folders that are compatible with your windows server.  Eg: windows server 2008 R2
We need the 64 bit dlls to be copied to 32 bit folder and 32 bit dlls copied to 64 bit folders.

Step1:
•    Open the “rfcsdk 64” folder containing the SAP RFC SDK 7.20 UNICODE 64-bit and access to the lib folder to copy the contents from “C:\SAP Resources\rfcsdk 64\lib”

•    Install the SAP RFC SDK 64-bit DLLs by coping (or drag) them to the “System32” folder in your system “Windows” folder  “C:\Windows\System32”:

Step 2:
•  Open the “rfcsdk 32” folder containing the SAP RFC SDK 7.20 UNICODE 32-bit and access to the lib folder to copy the contents from “C:\SAP Resources\rfcsdk 32\lib”

•    Install the SAP RFC SDK 32-bit DLLs by coping (or drag) them to the “SysWOW64” folder in your system “Windows” folder  “C:\Windows\SysWOW64”

Restart your BizTalk Host instance.

Written By
Swarna Prabhu
Microsoft GTSC