There’s a lit­tle known attribute which was intro­duced in the .Net frame­work 2.0 called con­fig­Source, which allows you to exter­nal­ize sec­tions of the con­fig­u­ra­tion file.

It works just like the optional file attribute found on the appSet­tings element:

<appSet­tings file = “rel­a­tive file name” />

but can be added to any con­fig­u­ra­tion sec­tion to spec­ify an exter­nal file for that section:

<Cus­tom­Sec­tion configSource=“relative file name” />

When it comes to WCF though, unfor­tu­nately the con­fig­Source attribute doesn’t work on the <system.serviceModel> sec­tion group, but luck­ily you can still apply it on the child con­fig sec­tions. See the ref­er­ence link below for some examples.

Ref­er­ence:

http://weblogs.asp.net/cibrax/archive/2007/07/24/configsource-attribute-on-system-servicemodel-section.aspx

Share