简体   繁体   中英

WCF Setting in code vs app.config

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>

Yep. Imperative run-time code trumps declarative settings.

当首先加载配置时,您的代码将覆盖设置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM