2

I have a Web.config that has this section:

<system.serviceModel>
    ...
    <client configSource="local.config" />
</system.serviceModel>

I would like to change the configSource to a different file from within the Global.asax Application_Start() method based on the execution path of the app.

I think can get the existing configuration using this, but I don't know what to do next:

var filemap = new ExeConfigurationFileMap { ExeConfigFilename = configFilePath };
var oldConfig = ConfigurationManager.OpenMappedExeConfiguration(filemap, ConfigurationUserLevel.None);
var serviceModelSectionGroup = System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup(oldConfig);

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.