ServiceThrottlingBehavior.MaxConcurrentCalls Propriedade
Definição
Obtém ou define um valor que especifica o número máximo de mensagens processando ativamente em um ServiceHost.Gets or sets a value that specifies the maximum number of messages actively processing across a ServiceHost.
public:
property int MaxConcurrentCalls { int get(); void set(int value); };
public int MaxConcurrentCalls { get; set; }
member this.MaxConcurrentCalls : int with get, set
Public Property MaxConcurrentCalls As Integer
Valor da propriedade
O limite superior de mensagens ativas no serviço.The upper limit of active messages in the service. O padrão é 16 vezes a contagem de processadores.The default is 16 times the processor count.
Exemplos
O exemplo de código a seguir mostra o uso de ServiceThrottlingBehavior de um arquivo de configuração de aplicativo que define as MaxConcurrentSessions MaxConcurrentCalls Propriedades, e como MaxConcurrentInstances 1 como um exemplo.The following code example shows the use of ServiceThrottlingBehavior from an application configuration file that sets the MaxConcurrentSessions, MaxConcurrentCalls, and MaxConcurrentInstances properties to 1 as an example. A experiência do mundo real determina quais são as configurações ideais para qualquer aplicativo específico.Real-world experience determines what the optimal settings are for any particular application.
<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>
Comentários
A MaxConcurrentCalls propriedade especifica o número máximo de mensagens processando ativamente em um ServiceHost objeto.The MaxConcurrentCalls property specifies the maximum number of messages actively processing across a ServiceHost object. Cada canal pode ter uma mensagem pendente que não conta com o valor de MaxConcurrentCalls até que Windows Communication Foundation (WCF) comece a processá-lo.Each channel can have one pending message that does not count against the value of MaxConcurrentCalls until Windows Communication Foundation (WCF) begins to process it.
Você também pode definir os valores desse atributo usando o elemento < perthrottling > em um arquivo de configuração de aplicativo.You can also set the values of this attribute by using the <serviceThrottling> element in an application configuration file.
Aviso
MaxConcurrentCalls deve ser definido como menor que o tamanho do pool de conexões SQL em cenários em fila.MaxConcurrentCalls should be set to less than the SQL connection pool size in queued scenarios.