Split App or Web.configwith: configSource

Sources:

Separating out WCF Configuration Into Multiple Files with configSource

Place sections in external file – example from BNRkre:

  <system.serviceModel>
    <bindings configSource="bin\SystemServiceModelBindings.config"/>
    <client configSource="bin\SystemServiceModelClient.config"/>
  </system.serviceModel>
</configuration>

If you wanted you could separate out your entire system.serviceModel section group into smaller files:

<configuration>
  <system.serviceModel>
    <services configSource="services.config"/>
    <bindings configSource="bindings.config"/>
    <behaviors configSource="behaviors.config"/>
    <extensions configSource="extensions.config"/>
  </system.serviceModel>
</configuration>

Note, however, that you can only use this for sections. This technique can’t be used for the system.serviceModel section group or for any config elements. Also note that the referenced files should contain only one section, and that you won’t need a <configuration> or <system.serviceModel> tag in them, just the section being referenced.

Advertisements
This entry was posted in c#, development, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s