views:

140

answers:

2

If I set a setting in the app.config and in code which one will get used?

Example:

Dim instance As ServiceThrottlingBehavior
Dim value As Integer

value = instance.MaxConcurrentInstances

instance.MaxConcurrentInstances = value

VS

<configuration>
  <system.serviceModel>
    <services>
     <behaviors>
      <serviceBehaviors>
        <behavior  name="Throttled">
          <serviceThrottling 
           maxConcurrentInstances="1"
          />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
A: 

As configuration is loaded first, your code will override the settings.

Ucodia
A: 

Yep. Imperative run-time code trumps declarative settings.

James Counihan