ServiceThrottlingBehavior.MaxConcurrentInstances 속성

정의

서비스에서 한 번에 실행할 수 있는 최대 InstanceContext 개체 수를 지정하는 값을 가져오거나 설정합니다.

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

속성 값

Int32

한 번에 실행할 수 있는 서비스의 최대 InstanceContext 개체 수입니다. 기본 값의 합계인 MaxConcurrentSessions 의 값과 MaxConcurrentCalls합니다.

예제

다음 코드 예제에서는 애플리케이션 구성 파일에서 ServiceThrottlingBehavior를 사용하여 MaxConcurrentSessions, MaxConcurrentCallsMaxConcurrentInstances 속성을 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>

설명

MaxConcurrentInstances 속성은 서비스의 최대 InstanceContext 개체 수를 지정합니다. MaxConcurrentInstances 속성과 InstanceContextMode 속성의 관계에 유의해야 합니다. InstanceContextModePerSession이면 결과 값은 총 세션 수입니다. InstanceContextModePerCall이면 결과 값은 동시 호출 수입니다. 최대 InstanceContext 개체 수에 이미 도달한 상태에서 메시지가 도착하면 해당 메시지는 InstanceContext 개체가 닫힐 때까지 보류됩니다.

애플리케이션 구성 파일에서 serviceThrottling> 요소를 사용하여< 이 특성의 값을 설정할 수도 있습니다.

적용 대상