ServicePoint.ConnectionName 属性

定义

获取连接名称。

public:
 property System::String ^ ConnectionName { System::String ^ get(); };
public string ConnectionName { get; }
member this.ConnectionName : string
Public ReadOnly Property ConnectionName As String

属性值

表示连接名称的 String

示例

Console::WriteLine( "ConnectionName = {0}", sp->ConnectionName );

// Display the maximum number of connections allowed on this 
// ServicePoint instance.
Console::WriteLine( "ConnectionLimit = {0}", sp->ConnectionLimit );

// Display the number of connections associated with this 
// ServicePoint instance.
Console::WriteLine( "CurrentConnections = {0}", sp->CurrentConnections );
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()))

注解

谨慎

WebRequestHttpWebRequestServicePointWebClient 已过时,不应将其用于新开发。 请改用 HttpClient

如果 ServicePoint 对象是通过调用具有 Uri 参数的 FindServicePoint 重载构造的,则 ConnectionName 属性表示所使用的 Uri 对象的 Scheme 属性。

如果 ServicePoint 对象是从网络主机和端口构造的,则 ConnectionName 属性包含表示主机和网络端口的字符串。 如果在从主机和端口构造时设置了 ConnectionName 属性,则只有具有相同 ConnectionGroupName 值的 WebRequest 对象才能使用此 ServicePoint 对象。

适用于

另请参阅