Intro
As promised in an earlier post, there is a bit of a quirk to using the eConnect 2013 adapter in 64 bit mode.
Symptoms
You are using a BizTalk 2016 64 bit server and have installed the
eConnect 2013 adapter 64 bit mode to the C:\Program Files\Microsoft Dynamics folder structure. You try to use the adapter to send a message to GP but receive the following exception:
The Messaging Engine failed to create the transport adapter "Dynamics GP eConnect".
OutboundAssemblyPath: "C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\Objects\DotNet\Microsoft.Dynamics.GP.eConnect.BizTalk.Adapter.dll"
OutboundTypeName: "Microsoft.Dynamics.GP.eConnect.Biztalk.Transmitter"
Exception Details: "Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\Objects\DotNet\Microsoft.Dynamics.GP.eConnect.BizTalk.Adapter.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Cause
The key to this is the part of the exception which states "
Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\Objects\DotNet\Microsoft.Dynamics.GP.eConnect.BizTalk.Adapter.dll'" as this isn't where we installed the adapter.
There are two issues here. First, how do you tell BizTalk it's looking in the wrong folder? Second...
Hey! that DLL does exist in C:\Program Files (x86)\Microsoft Dynamics! Oh, and in C:\Program Files\Microsoft Dynamics as well!
It seems the 64 bit eConnect installer writes into both folders and presumably installs the 64 bit version in one and the 32 bit in the other. It then tries to use the 32 bit version from the 64 bit host instance and chokes.
Workaround
After some hacking through BizTalk and eConnect documentation and configuration it seems it's not easy to tell BizTalk which folder to look in. However it appears using the DLLs in C:\Program Files (x86)\Microsoft Dynamics is a viable option. In our case we simply created a dedicated host instance for 32 bit adapters and then configured the eConnect adapter to use this instance instead.
One point of note. After doing this and then restarting the host instances you will be unable to resume the suspended message instances. They will throw the following exception:
A message sent to adapter "BiztalkMessagingEngine" on send port "Post Outbound eConnectSalesInvoice Message to GP FNL" with URI "data source=GPDatabase;initial catalog=FNL;integrated security=SSPI;persist security info=False;packet size=4096" is suspended.
Error details: Unknown Error Description
MessageId: {DD3BC94A-6FC6-4B77-8871-3898DAB2CA89}
InstanceID: {50177942-B210-4BA0-AF27-323B8430B6E5}
While this exception looks unfriendly at first it is actually quite informative. The adpater called "BizTalkMessageEngine" is actually a kind of wrapper for all other adapters. What it's saying here is that the underlying adapter has failed and has not been able to send any exception details back.
Or, to put it another way, resuming the eConnect message using an adapter that has been entirely reconfigured to use a different processor architecture using different DLLs has been a fraction promlematic. Fair enough I guess. Terminate the message instances. The ones from this point on will work fine.