Splitting a configuration section (specifically a WCF section) into multiple config sections?

I have this section in my web.config:

  <system.serviceModel>
    <behaviors configSource="ConfigurationActiveServiceModelBehaviors.config" />
    <services configSource="ConfigurationActiveServiceModelServices.config" />
    <bindings configSource="ConfigurationCommonServiceModelBindings.config" />
    <client configSource="ConfigurationActiveServiceModelClient.config" />
  </system.serviceModel>

I want to add another client section with a different path to prevent configuration duplication:

  <system.serviceModel>
    <behaviors configSource="ConfigurationActiveServiceModelBehaviors.config" />
    <services configSource="ConfigurationActiveServiceModelServices.config" />
    <bindings configSource="ConfigurationCommonServiceModelBindings.config" />
    <client configSource="ConfigurationActiveServiceModelClient.config" />
    <client configSource="ConfigurationCommonServiceModelClient.config" /> <!-- this -->
  </system.serviceModel>

I understand that a section can appear only once. Is there anyway I can work this around? Like a partial section or something?


Source: .net

Leave a Reply