更新 : 2007 年 11 月
サービス パフォーマンスを調整できるようにするランタイム スループット設定を構成します。
名前空間 :
System.ServiceModel.Description
アセンブリ :
System.ServiceModel (System.ServiceModel.dll 内)
Public Class ServiceThrottlingBehavior _
Implements IServiceBehavior
Dim instance As ServiceThrottlingBehavior
public class ServiceThrottlingBehavior : IServiceBehavior
public ref class ServiceThrottlingBehavior : IServiceBehavior
public class ServiceThrottlingBehavior implements IServiceBehavior
public class ServiceThrottlingBehavior implements IServiceBehavior
ServiceThrottlingBehavior クラスを使用して、アプリケーションのメモリ不足を防ぐためのさまざまなスループット設定を制御します。
MaxConcurrentCalls プロパティは、ServiceHost で同時に処理できるメッセージの数を制限します。
MaxConcurrentInstances プロパティは、ServiceHost で同時に実行できる InstanceContext オブジェクトの数を制限します。
MaxConcurrentSessions プロパティは、ServiceHost オブジェクトが受け入れ可能なセッションの数を制限します。
実行時の負荷分散にはアプリケーションの実行エクスペリエンスが必要なため、サービスのパフォーマンスを最大化するために実行を変更する場合は、アプリケーション構成ファイルから ServiceThrottlingBehavior を使用する方法が最も一般的です。
メモ : |
|---|
これらのプロパティの値に到達するたびにトレースが出力されます。最初のトレースは警告として出力されます。 |
アプリケーション構成ファイルの <serviceThrottling> 要素を使用することで、この属性の値を設定することもできます。
例として、MaxConcurrentSessions、MaxConcurrentCalls、および MaxConcurrentInstances の各プロパティを 1 に設定するアプリケーション構成ファイルから ServiceThrottlingBehavior を使用する方法を次のコード例に示します。特定のアプリケーションで最適な設定については、実際の動作から判断します。
<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
参照