通过


Port 类

定义

定义 XML Web 服务中包含的单个终结点。 无法继承此类。

public ref class Port sealed : System::Web::Services::Description::DocumentableItem
public ref class Port sealed : System::Web::Services::Description::NamedItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class Port : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class Port : System.Web.Services.Description.NamedItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type Port = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type Port = class
    inherit NamedItem
Public NotInheritable Class Port
Inherits DocumentableItem
Public NotInheritable Class Port
Inherits NamedItem
继承
继承
属性

示例

以下示例创建一个 Port 并将其添加到 Ports 现有 ServiceDescription 命名 myDescription的集合中。

// Create a Port.
Port^ postPort = gcnew Port;
postPort->Name = "PortServiceHttpPost";
postPort->Binding = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" );

// Create an HttpAddressBinding.
HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding;
postAddressBinding->Location = "http://localhost/PortClass/PortService_cs.asmx";

// Add the HttpAddressBinding to the Port.
postPort->Extensions->Add( postAddressBinding );

// Get the Service of the postPort.
Service^ myService = postPort->Service;

// Print the service name for the port.
Console::WriteLine( "This is the service name of the postPort:*{0}*", myDescription->Services[ 0 ]->Ports[ 0 ]->Service->Name );

// Add the Port to the PortCollection of the ServiceDescription.
myDescription->Services[ 0 ]->Ports->Add( postPort );
// Create a Port.
Port postPort = new Port();
postPort.Name = "PortServiceHttpPost";
postPort.Binding = new XmlQualifiedName("s0:PortServiceHttpPost");

// Create an HttpAddressBinding.
HttpAddressBinding postAddressBinding = new HttpAddressBinding();
postAddressBinding.Location =
   "http://localhost/PortClass/PortService_cs.asmx";

// Add the HttpAddressBinding to the Port.
postPort.Extensions.Add(postAddressBinding);

// Get the Service of the postPort.
Service myService = postPort.Service;

// Print the service name for the port.
Console.WriteLine("This is the service name of the postPort:*" +
   myDescription.Services[0].Ports[0].Service.Name + "*");

// Add the Port to the PortCollection of the ServiceDescription.
myDescription.Services[0].Ports.Add(postPort);

' Create a Port.
Dim postPort As New Port()
postPort.Name = "PortServiceHttpPost"
postPort.Binding = New XmlQualifiedName("s0:PortServiceHttpPost")


' Create an HttpAddressBinding.
Dim postAddressBinding As New HttpAddressBinding()
postAddressBinding.Location = _
   "http://localhost/PortClass/PortService.vb.asmx"

' Add the HttpAddressBinding to the Port.
postPort.Extensions.Add(postAddressBinding)

' Get the Service of the postPort.
Dim myService As Service = postPort.Service

' Print the service name for the port.
Console.WriteLine("This is the service name of the postPort:*" & _
   myDescription.Services(0).Ports(0).Service.Name & "*")

' Add the Port to the PortCollection of the ServiceDescription.
myDescription.Services(0).Ports.Add(postPort)

注解

此类指定一个 Binding地址(URI),该地址定义给定 PortType操作和消息的消息格式和协议详细信息。 该 Binding 属性获取或设置指定 Port值。

此类对应于 Web 服务描述语言 (WSDL) <port> 元素,该元素由 <service> 该元素括起来。 有关 WSDL 的详细信息,请参阅 WSDL 规范。

构造函数

名称 说明
Port()

初始化 Port 类的新实例。

属性

名称 说明
Binding

获取或设置 . 的 PortXML <binding> 特性的值。

Documentation

获取或设置该实例 DocumentableItem的文本文档。

(继承自 DocumentableItem)
DocumentationElement

获取或设置 . DocumentableItem的文档元素。

(继承自 DocumentableItem)
ExtensibleAttributes

获取或设置一个类型 XmlAttribute 数组,该数组表示 WSDL 的属性扩展,以符合 Web 服务互操作性(WS-I) 基本配置文件 1.1。

(继承自 DocumentableItem)
Extensions

获取与 .. 关联的 Port扩展性元素的集合。

Name

获取或设置 . 的名称 Port

Name

获取或设置项的名称。

(继承自 NamedItem)
Namespaces

获取或设置构造对象时 ServiceDescription 用于保留命名空间前缀和命名空间的命名空间前缀和命名空间的字典。

(继承自 DocumentableItem)
Service

Service获取其Port成员。

方法

名称 说明
Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅