Invoking .net DLL, which calls an external asmx service



We created an .net class library, which invokes an external asmx service. We deployed this DLL into GAC on our AX servers and the ax32serv.exe.config has been modified to include the endpoint and binding information.


This works great when the X++ code that calls the DLL is running on the server. It fails when we invoke the  DLL from X++ code that runs on a client.

We get the following error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Could not find default endpoint element that references contract 'ServiceReference1.XYZ' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

Our clients are of two types:

1. local clients

2. remote clients that go through remote desktop servers. 


Which config file needs to be updated for these DLL calls to be invoked properly.