My Questions is:
I want to call WCF Service methods via Visual Studio Addin and the addin/or Visual Studio host is looking int the wrong place for configurations ( or maybe its looking at the right place but the config is at the wrong place)?
What is the best practice to do this?
I am developing an Visual Studio 2010 Addin that needs to call a WCF service to get data and do some processing.
I have successfully added the WCF Service reference and created client as follows:
WcfServiceClient client = new WcfServiceClient()
When the control reached the above line in my code, i get the following error:
Could not find default endpoint element that references contract 'WcfService.IWcfService' 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.
Now the endpoint and binding information is there in the app.config file. What is happening here is:
When Visual Studio exe (devenv.exe) loads the plugin and executes the part of code where it has to create a WCF Service client, it attempts to load devenv.exe.config instead of MyAddin.dll.config file
The solution seems to be: Copy and paste WCF Service binding and service model client data from app.config to devenv.exe.config and maybe it will work then.
Best practice advice please?
Thanks
Steve