ServicePoint.ConnectionLimit Propriedade

Definição

Obtém ou define o número máximo de ligações permitidas neste ServicePoint objeto.

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

Valor de Propriedade

O número máximo de ligações permitido neste ServicePoint objeto.

Exceções

O limite de ligação é igual ou menor que 0.

Exemplos

O exemplo de código seguinte utiliza a ConnectionLimit propriedade para verificar o número máximo de ligações que o ServicePoint objeto pode fazer ao Identificador Uniforme de Recursos (URI) especificado.

Console.WriteLine("ConnectionName = " + sp.ConnectionName);

// Display the maximum number of connections allowed on this
// ServicePoint instance.
Console.WriteLine("ConnectionLimit = " + sp.ConnectionLimit);

// Display the number of connections associated with this
// ServicePoint instance.
Console.WriteLine("CurrentConnections = " + sp.CurrentConnections);
Console.WriteLine(("ConnectionName = " + sp.ConnectionName))

' Display the maximum number of connections allowed on this 
' ServicePoint instance.
Console.WriteLine(("ConnectionLimit = " + sp.ConnectionLimit.ToString()))

' Display the number of connections associated with this 
' ServicePoint instance.
Console.WriteLine(("CurrentConnections = " + sp.CurrentConnections.ToString()))

Observações

Atenção

WebRequest, HttpWebRequest, ServicePoint, e WebClient são obsoletos, e não deves usá-los para novos desenvolvimentos. Utilize HttpClient em substituição.

A ConnectionLimit propriedade define o número máximo de ligações que o ServicePoint objeto pode fazer a um recurso da Internet. O valor da ConnectionLimit propriedade é definido para o valor da ServicePointManager.DefaultConnectionLimit propriedade quando o ServicePoint objeto é criado; alterações subsequentes para DefaultConnectionLimit não terem efeito sobre objetos existentes ServicePoint .

O limite de ligação não se aplica a ligações proxyed ou túneis proxy.

Note

Desde .NET 9, esta propriedade corresponde a SocketsHttpHandler.MaxConnectionsPerServer. No entanto, os handlers não são reutilizados entre pedidos, por isso não tem qualquer impacto significativo.

Aplica-se a

Ver também