ServiceThrottlingBehavior.MaxConcurrentCalls プロパティ

定義

ServiceHost でアクティブに処理されるメッセージの最大数を指定する値を取得または設定します。

public:
 property int MaxConcurrentCalls { int get(); void set(int value); };
public int MaxConcurrentCalls { get; set; }
member this.MaxConcurrentCalls : int with get, set
Public Property MaxConcurrentCalls As Integer

プロパティ値

サービス内でアクティブなメッセージの数の上限。 既定値は、プロセッサ数の 16 倍です。

例として、ServiceThrottlingBehaviorMaxConcurrentSessions、および MaxConcurrentCalls の各プロパティを 1 に設定するアプリケーション構成ファイルから MaxConcurrentInstances を使用する方法を次のコード例に示します。 特定のアプリケーションで最適な設定については、実際の動作から判断します。

<configuration>
  <appSettings>
    <!-- use appSetting to configure base address provided by host -->
    <add key="baseAddress" value="http://localhost:8080/ServiceMetadata" />
  </appSettings>
  <system.serviceModel>
    <services>
      <service 
        name="Microsoft.WCF.Documentation.SampleService"
        behaviorConfiguration="Throttled" >
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/SampleService"/>
          </baseAddresses>
        </host>
        <endpoint
          address=""
          binding="wsHttpBinding"
          contract="Microsoft.WCF.Documentation.ISampleService"
         />
        <endpoint
          address="mex"
          binding="mexHttpBinding"
          contract="IMetadataExchange"
         />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior  name="Throttled">
          <serviceThrottling 
            maxConcurrentCalls="1" 
            maxConcurrentSessions="1" 
            maxConcurrentInstances="1"
          />
          <serviceMetadata 
            httpGetEnabled="true" 
            httpGetUrl=""
          />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

注釈

MaxConcurrentCalls プロパティは、ServiceHost オブジェクトでアクティブに処理されるメッセージの最大数を指定します。 各チャネルには、Windows Communication Foundation (WCF) が処理を開始するまで の値にカウントされない保留中の MaxConcurrentCalls メッセージを 1 つ含めることができます。

アプリケーション構成ファイルで serviceThrottling> 要素を<使用して、この属性の値を設定することもできます。

警告

MaxConcurrentCalls は、キューに入ったシナリオでは SQL 接続プールのサイズより小さい値に設定する必要があります。

適用対象