次の方法で共有


ServiceThrottle.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 倍です。

次のコード例では、アプリケーション構成ファイル内の ServiceThrottle を参照することにより、ServiceThrottlingBehavior の典型的な使用方法を表示しています。 このケースでは、指定された値が、任意の一時点において 1 つの接続から 1 つの InstanceContext に対して確立するメッセージ処理は、多くとも 1 つです。 実際の使用方法は、経験を通して決定する必要があります。

<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 つ含めることができます。

注意

このプロパティの値を超えるたびにトレースが出力されます。

適用対象