【问题标题】:WCF Setting in code vs app.config代码与 app.config 中的 WCF 设置
【发布时间】:2011-01-11 12:41:26
【问题描述】:

如果我在 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>

【问题讨论】:

    标签: wcf settings app-config


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-04-13
        • 2010-09-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-01
        相关资源
        最近更新 更多