Share via


ServiceThrottle クラス

定義

サービスのスループットを制御して可用性とパフォーマンスを最適化します。

public ref class ServiceThrottle sealed
public sealed class ServiceThrottle
type ServiceThrottle = class
Public NotInheritable Class ServiceThrottle
継承
ServiceThrottle

次のコード例では、アプリケーション構成ファイル内の 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>

注釈

サービスのパフォーマンス特性を調整するには ServiceThrottle を使用します。 サービスの ServiceThrottle を構成する最も簡単な方法は、ServiceThrottlingBehavior を使用することで、アプリケーション構成ファイルを使用すると、特に簡単です。

MaxConcurrentCalls プロパティは、ServiceHost オブジェクト内のすべてのディスパッチャー オブジェクトをアクティブに処理するメッセージの最大数を表します。

MaxConcurrentInstances プロパティは、サービス内の InstanceContext オブジェクトの最大数を表します。

MaxConcurrentSessions プロパティは、ServiceHost が受け入れ可能なセッションの最大数を表します。

注意

トレースは、最初の呼び出し、InstanceContext、またはセッションが待機リストのキューに置かれたときに出力されます。 最初のトレースは警告として出力されます。

プロパティ

MaxConcurrentCalls

ServiceHost のすべてのディスパッチャー オブジェクトでアクティブに処理中のメッセージの最大数を取得または設定します。

MaxConcurrentInstances

一度に実行可能なサービス オブジェクトの最大数を取得または設定します。

MaxConcurrentSessions

ServiceHost オブジェクトが同時に受け入れ可能なセッションの最大数を指定する値を取得または設定します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象