共用方式為


ServiceEndpoint 建構函式

定義

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

多載

ServiceEndpoint(ContractDescription)

初始化指定合約的 ServiceEndpoint 類別的新執行個體。

ServiceEndpoint(ContractDescription, Binding, EndpointAddress)

使用指定的合約、繫結和位址,初始化 ServiceEndpoint 類別的新執行個體。

ServiceEndpoint(ContractDescription)

初始化指定合約的 ServiceEndpoint 類別的新執行個體。

public:
 ServiceEndpoint(System::ServiceModel::Description::ContractDescription ^ contract);
public ServiceEndpoint (System.ServiceModel.Description.ContractDescription contract);
new System.ServiceModel.Description.ServiceEndpoint : System.ServiceModel.Description.ContractDescription -> System.ServiceModel.Description.ServiceEndpoint
Public Sub New (contract As ContractDescription)

參數

contract
ContractDescription

服務端點的 ContractDescription

範例

ContractDescription cd = new ContractDescription("Calculator");
ServiceEndpoint svcEndpoint = new ServiceEndpoint(cd);
Dim cd As New ContractDescription("Calculator")
Dim svcEndpoint As New ServiceEndpoint(cd)

備註

當組態中提供端點的繫結和位址時,請使用這個建構函式。

適用於

ServiceEndpoint(ContractDescription, Binding, EndpointAddress)

使用指定的合約、繫結和位址,初始化 ServiceEndpoint 類別的新執行個體。

public:
 ServiceEndpoint(System::ServiceModel::Description::ContractDescription ^ contract, System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ address);
public ServiceEndpoint (System.ServiceModel.Description.ContractDescription contract, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address);
new System.ServiceModel.Description.ServiceEndpoint : System.ServiceModel.Description.ContractDescription * System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress -> System.ServiceModel.Description.ServiceEndpoint
Public Sub New (contract As ContractDescription, binding As Binding, address As EndpointAddress)

參數

contract
ContractDescription

服務端點的 ContractDescription

binding
Binding

指定服務端點如何與外界溝通的 Binding

address
EndpointAddress

服務端點的 EndpointAddress

範例

string address = "http://localhost:8001/CalculatorService";

ServiceEndpoint endpoint = new ServiceEndpoint(
    ContractDescription.GetContract(
        typeof(ICalculator),
        typeof(CalculatorService)),
        new WSHttpBinding(),
        new EndpointAddress(address));
Dim address As String = "http://localhost:8001/CalculatorService"

Dim endpoint As New ServiceEndpoint(ContractDescription.GetContract(GetType(ICalculator), GetType(CalculatorService)), New WSHttpBinding(), New EndpointAddress(address))

備註

請使用這個建構函式,以命令方式在程式碼中指定服務端點。

適用於