Load custom serviceModel in C#

Viewed 26

In my C# program I load a custom app.config, using this code:

var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = location };
Config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);

In my app.config, there is also a section <system.serviceModel> with a service reference. This server reference is used like this:

var client = new MyClient();

However, this client is using the configuration of the original app.config, and not of the loaded configuration from the "Config". How can I use a the serviceModel part from an external app.config?

0 Answers
Related