Split App or Web.configwith: configSource 2

WCF configuration files can sometimes be very, very long. Therefore it can be a good thing to separate out some of the sections. Here is a fast overview on how to do it.

Place sections in external file – example from BNRkre:

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

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

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

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.

Separating out WCF Configuration Into Multiple Files with configSource



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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s