編輯

共用方式為


ServiceEndpoint Constructors

Definition

Initializes a new instance of the ServiceEndpoint class.

Overloads

ServiceEndpoint(ContractDescription)

Initializes a new instance of the ServiceEndpoint class for a specified contract.

ServiceEndpoint(ContractDescription, Binding, EndpointAddress)

Initializes a new instance of the ServiceEndpoint class with a specified contract, binding, and address.

ServiceEndpoint(ContractDescription)

Source:
ServiceEndpoint.cs
Source:
ServiceEndpoint.cs

Initializes a new instance of the ServiceEndpoint class for a specified contract.

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)

Parameters

contract
ContractDescription

The ContractDescription for the service endpoint.

Examples

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

Remarks

Use this constructor when the binding and address for the endpoint are provided in configuration.

Applies to

ServiceEndpoint(ContractDescription, Binding, EndpointAddress)

Source:
ServiceEndpoint.cs
Source:
ServiceEndpoint.cs

Initializes a new instance of the ServiceEndpoint class with a specified contract, binding, and address.

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)

Parameters

contract
ContractDescription

The ContractDescription for the service endpoint.

binding
Binding

The Binding that specifies how the service endpoint communicates with the world.

address
EndpointAddress

The EndpointAddress for the service endpoint.

Examples

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))

Remarks

Use this constructor to specify a service endpoint imperatively in code.

Applies to