ServiceEndpoint 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 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。
- 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))
注解
使用此构造函数可以在代码中强制指定服务终结点。