代码与app.config中的WCF设置

时间:2010-01-31 22:12:57

标签: wcf settings app-config

如果我在app.config和代码中设置了一个将被使用的设置?

示例:

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>

2 个答案:

答案 0 :(得分:1)

是的。命令式运行时代码胜过声明性设置。

答案 1 :(得分:0)

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