Используя С#.NET 3.5 и WCF, я пытаюсь выписать часть конфигурации WCF в клиентском приложении (имя сервера, к которому клиент подключается).
Очевидным способом является использование ConfigurationManager
для загрузки раздела конфигурации и записи необходимых мне данных.
var serviceModelSection = ConfigurationManager.GetSection("system.serviceModel");
Появляется, чтобы всегда возвращать значение null.
var serviceModelSection = ConfigurationManager.GetSection("appSettings");
Работает отлично.
Раздел конфигурации присутствует в App.config, но по какой-то причине ConfigurationManager
отказывается загружать раздел system.ServiceModel
.
Я хочу не вручную загружать файл xxx.exe.config и использовать XPath, но если мне придется прибегнуть к тому, что я сделаю. Просто кажется, что это взломать.
Любые предложения?