This is a mirror of official site: http://jasper-net.blogspot.com/

ConfigSource attribute on system.serviceModel section

| Wednesday, June 20, 2012
The configSource attribute was firstly introduced in .NET framework 2.0 to support external configuration files.

This attribute can be added to any configuration section to specify a an external file for that section. Using an external configuration source can be useful in many scenarios. For instance, you could place a section into an external configSource if you need an easy method to swap settings for the section depending on the environment (development, test, or production), or  you need granular control over permissions.

Unfortunately, the system.serviceModel section group does not support this attribute. If you try to add it, you will receive the following exception:

The attribute 'configSource' cannot be specified because its name starts with the reserved prefix 'config' or 'lock'

What I found out is that you can use this attribute on the different sections under system.serviceModel such as services, behaviors or bindings.

For instance, the configuration file could look like this,

<configuration>
 
  <system.serviceModel>
    <services configSource="Services.config" >
    </services>
 
    <bindings configSource="Bindings.config">
    </bindings>
 
    <behaviors configSource="Behaviors.config">
    </behaviors>
 
  </system.serviceModel>
 
</configuration>
 And then, each file contains the corresponding section.

Services.config

<services>
  <service name="Microsoft.ServiceModel.Samples.CalculatorService"
          behaviorConfiguration="CalculatorServiceBehavior">
    <host>

QR: Inline image 1

Posted via email from Jasper-net

1 comments:

Anonymous said...

Its like you read my thoughts! You appear to know a lot approximately
this, like you wrote the guide in it or something.

I believe that you just could do with a few p.c. to drive
the message house a little bit, but other than
that, this is great blog. A fantastic read.
I will certainly be back.

Look into my homepage - raspberry ketone diet reviews