【问题标题】:WCF - How to configure Site-level web.config and make all services use a same behaviorConfigurationWCF - 如何配置站点级 web.config 并使所有服务使用相同的行为配置
【发布时间】:2011-04-16 16:54:30
【问题描述】:

我有一个托管 60 多个服务的网站。

使用 wcf 配置的简化版本,我不必指定所有服务及其对应的端点。

问题是我如何指定服务主机以对所有服务端点使用相同的行为配置?

我不想列出 web.config 中的所有端点并在每个端点上指定 behaviorConfiguration。我希望该虚拟目录上托管的所有 wcf 服务都使用相同的行为配置。有什么办法吗?

【问题讨论】:

    标签: wcf silverlight-4.0 wcf-configuration


    【解决方案1】:

    我找到了答案。我只需要删除我的端点行为的名称

    从此:

    <behaviors>
      ...
      <endpointBehaviors>
        <behavior name="MyCustomBehavior">
          <myCustomExt/>
        </behavior>
      </endpointBehaviors>
      ...
    </behaviors>
    

    到这里:

    <behaviors>
      ...
      <endpointBehaviors>
        <behavior>
          <myCustomExt/>
        </behavior>
      </endpointBehaviors>
      ...
    </behaviors>
    

    更多详情请看这里Setting Configuration Defaults with Nameless Elements in WCF 4

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-23
      • 1970-01-01
      • 1970-01-01
      • 2019-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多