共用方式為


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 Services Description Language(WSDL) <port> 元素,並被元素包圍 <service> 。 欲了解更多關於 WSDL 的資訊,請參閱 WSDL 規範。

建構函式

名稱 Description
Port()

初始化 Port 類別的新執行個體。

屬性

名稱 Description
Binding

取得或設定 XML <binding> 屬性 Port的值。

Documentation

取得或設定 實例 DocumentableItem的文字文件。

(繼承來源 DocumentableItem)
DocumentationElement

取得或設定 文件元素。DocumentableItem

(繼承來源 DocumentableItem)
ExtensibleAttributes

取得或設定一個型別 XmlAttribute 陣列,代表 WSDL 的屬性擴充,以符合 Web Services 互通性(WS-I)Basic Profile 1.1。

(繼承來源 DocumentableItem)
Extensions

取得與 相關聯的可擴展元素集合。Port

Name

取得或設定 的名稱。Port

Name

取得或設定物品名稱。

(繼承來源 NamedItem)
Namespaces

取得或設定命名空間前綴與命名空間的字典,用於在物件建構時 ServiceDescription 保留命名空間前綴與命名空間。

(繼承來源 DocumentableItem)
Service

獲得 ServicePort 所屬的成員。

方法

名稱 Description
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於

另請參閱