开发者

WCF Setting in code vs app.config

开发者 https://www.devze.com 2022-12-19 05:20 出处:网络
If I set a setting in the app.config and in code which one will get used? Example: Dim instance As ServiceThrottlingBehavior

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>
开发者_JAVA技巧      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>


Yep. Imperative run-time code trumps declarative settings.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消