I have a complex set of add-in's that we need to run in ArcMap, ArcServer, and ArcGIS Explorer for Desktop. We are experimenting with changing from the old Web Reference service connection to a WCF Service Reference connection.

When I try to create the client it cannot find the configuration settings to create the client. When I add just the URI to the embedded Settings.settings file, and create an EndpointAddress and Binding object to pass to the client, I get a client but my first attempt to access the server fails.

So how do I access the WCF service configuration data from inside an ArcMap Addin?

  • This sounds like two different questions to me. 1) How to read configuration and 2) How to access a WCF service. I would suggest tackling one at a time.
    – blah238
    Mar 28 '14 at 19:41
  • I have the how, but I cannot execute the how because the client wants to load it's data from application configuration data. I modified the question to clarify the results. Mar 28 '14 at 20:02
  • How do you know it cannot find the configuration settings? Have you tried debugging the add-in at the point where the configuration settings are read to see what value if any is being read? If you're just trying to read a string out of the embedded Settings.settings file, Properties.Settings.Default.<yourSettingName> should work.
    – blah238
    Mar 28 '14 at 23:05
  • I know it cannot get the settings because WCF throws an exception saying that the configuration cannot be found. Apr 11 '14 at 12:41

I spent the better part of the day trying to figure this out.

I found an answer on geonet https://geonet.esri.com/thread/98429

Simply, it isn't seeing the app.config.

You need to setup all the bindings manually.

WSHttpBinding binding = new WSHttpBinding();
binding.Security.Transport.ClientCredentialType =HttpClientCredentialType.None;

EndpointAddress remoteAddress = new EndpointAddress("SERVICEENDPOINT");
Service1Client client = new Service1Client(binding, remoteAddress);

You may find an issue with a 415 error and encoding. I found this an issue too. I ended up using:

BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Transport.ClientCredentialType =HttpClientCredentialType.None;
binding.MessageEncoding = WSMessageEncoding.Text

EndpointAddress remoteAddress = new EndpointAddress("SERVICEENDPOINT");
Service1Client client = new Service1Client(binding, remoteAddress);

'call what ever you need here'

After I did this it worked.



I found a current approach to this by adding WCF data to the Arcmap.exe.config file. This, however is just a workaround. I would prefer WCF go after an external config.


The second answer of KevonFredrico worked well for me. With the BasicHttpBinding object you can indicate extra properties that are specified in your app.config like TransferMode or SendTimeout:

binding.TransferMode = TransferMode.Streamed;
binding.SendTimeout = new TimeSpan(0,10,0); //10 minutes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.