0

我有一项服务有两种行为。一个用于节流,另一个用于元数据交换。如何在服务中启用两者?当我们第一次启用时,第二次被禁用,反之亦然。

我的行为名称是 MexBehaviour 和 ThrottlingBehaviour。服务适用于以下行之一,但不能同时适用于两者:

 <service behaviorConfiguration="ThrottlingBehaviour" 
                   name="ThrottlingService.ThrottlingService">

 <service behaviorConfiguration="MexBehaviour" 
                   name="ThrottlingService.ThrottlingService">

如何同时指定两者?

4

1 回答 1

1

行为配置指定服务的行为是什么样的。要组合行为,您将使用这些组合创建一个行为,然后指向该行为

如果您正在使用 WCF 元数据和限制行为,将它们组合起来,您将创建一个像这样的新行为

<behaviors>
  <serviceBehaviors>
    <behavior name="metathrottle">
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <serviceThrottling maxConcurrentCalls="100"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

然后在您的服务中指向此配置

<service behaviorConfiguration="metathrottle" name="ThrottlingService.ThrottlingService">
于 2014-09-09T22:42:42.750 回答