ServiceEndpoint Class

Definition

表示服務的端點,允許服務的用戶端尋找並與服務通訊。Represents the endpoint for a service that allows clients of the service to find and communicate with the service.

public ref class ServiceEndpoint
public class ServiceEndpoint
type ServiceEndpoint = class
Public Class ServiceEndpoint
Inheritance
ServiceEndpoint
Derived

Examples

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

ContractDescription cd = new ContractDescription("Calculator");
ServiceEndpoint svcEndpoint = new ServiceEndpoint(cd);

ServiceEndpoint endpnt = serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

Console.WriteLine("Address: {0}", endpnt.Address);

// Enable Mex
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
serviceHost.Description.Behaviors.Add(smb);

serviceHost.Open();
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

Dim cd As New ContractDescription("Calculator")
Dim svcEndpoint As New ServiceEndpoint(cd)

Dim endpnt As ServiceEndpoint = serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

Console.WriteLine("Address: {0}", endpnt.Address)

' Enable Mex
Dim smb As New ServiceMetadataBehavior()
smb.HttpGetEnabled = True
serviceHost.Description.Behaviors.Add(smb)

serviceHost.Open()

Remarks

服務端點包含有關位址、繫結、合約和行為的資訊,用戶端需要這些資訊以尋找並與這個端點的服務互動。The service endpoint contains the information about the address, binding, contract, and behavior required by a client to find and interact with the service at this endpoint.

Constructors

ServiceEndpoint(ContractDescription)

初始化指定合約的 ServiceEndpoint 類別的新執行個體。Initializes a new instance of the ServiceEndpoint class for a specified contract.

ServiceEndpoint(ContractDescription, Binding, EndpointAddress)

使用指定的合約、繫結和位址,初始化 ServiceEndpoint 類別的新執行個體。Initializes a new instance of the ServiceEndpoint class with a specified contract, binding, and address.

Properties

Address

取得或設定服務端點的端點位址。Gets or sets the endpoint address for the service endpoint.

Behaviors

取得服務端點的行為。Gets the behaviors for the service endpoint.

Binding

取得或設定服務端點的繫結。Gets or sets the binding for the service endpoint.

Contract

取得服務端點的合約。Gets the contract for the service endpoint.

EndpointBehaviors

取得服務的端點行為。Gets the endpoint behaviors for the service.

IsSystemEndpoint

取得或設定服務端點是否由系統產生,而非由使用者定義。Gets or sets whether the service endpoint is generated by the system as opposed to being user-defined.

ListenUri

取得或設定服務端點接聽的 URI。Gets or sets the URI at which the service endpoint listens.

ListenUriMode

取得或設定傳輸如何處理提供給服務接聽的 URI。Gets or sets how the transport handles the URI that is provided for the service to listen on.

Name

取得或設定服務端點的名稱。Gets or sets the name of the service endpoint.

Methods

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

Applies to