System.ServiceModel.Descrip ...


.NET Framework クラス ライブラリ
ServiceThrottlingBehavior クラス

更新 : 2007 年 11 月

サービス パフォーマンスを調整できるようにするランタイム スループット設定を構成します。

名前空間 :  System.ServiceModel.Description
アセンブリ :  System.ServiceModel (System.ServiceModel.dll 内)
構文

Visual Basic (宣言)
Public Class ServiceThrottlingBehavior _
    Implements IServiceBehavior
Visual Basic (使用法)
Dim instance As ServiceThrottlingBehavior
C#
public class ServiceThrottlingBehavior : IServiceBehavior
Visual C++
public ref class ServiceThrottlingBehavior : IServiceBehavior
J#
public class ServiceThrottlingBehavior implements IServiceBehavior
JScript
public class ServiceThrottlingBehavior implements IServiceBehavior
解説

ServiceThrottlingBehavior クラスを使用して、アプリケーションのメモリ不足を防ぐためのさまざまなスループット設定を制御します。

MaxConcurrentCalls プロパティは、ServiceHost で同時に処理できるメッセージの数を制限します。

MaxConcurrentInstances プロパティは、ServiceHost で同時に実行できる InstanceContext オブジェクトの数を制限します。

MaxConcurrentSessions プロパティは、ServiceHost オブジェクトが受け入れ可能なセッションの数を制限します。

実行時の負荷分散にはアプリケーションの実行エクスペリエンスが必要なため、サービスのパフォーマンスを最大化するために実行を変更する場合は、アプリケーション構成ファイルから ServiceThrottlingBehavior を使用する方法が最も一般的です。

ms522191.alert_note(ja-jp,VS.90).gifメモ :

これらのプロパティの値に到達するたびにトレースが出力されます。最初のトレースは警告として出力されます。

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


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

xml
<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>
継承階層

System..::.Object
  System.ServiceModel.Description..::.ServiceThrottlingBehavior
スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報

.NET Framework

サポート対象 : 3.5、3.0
参照

参照

タグ :


Page view tracker