다음을 통해 공유


ServiceThrottle.MaxConcurrentInstances 속성

정의

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

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 개체 수입니다. 기본값은 최대 동시 호출 수 + 최대 동시 세션 수입니다.

예제

다음 코드 예제에서는 애플리케이션 구성 파일에서 ServiceThrottle를 참조하여 ServiceThrottlingBehavior을 사용하는 일반적인 방법을 보여 줍니다. 이 경우 지정되는 값은 한 InstanceContext에 대한 하나의 연결에서 한 번에 최대 하나의 메시지 처리만 설정합니다. 실제 사용량은 경험을 통해 결정해야 합니다.

<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 개체가 닫힐 때까지 보류됩니다.

참고

이 속성 값이 초과될 때마다 추적이 기록됩니다. 첫 번째 추적이 경고로 기록됩니다.

적용 대상