ServiceHost.AddServiceEndpoint 方法

定义

将服务终结点添加到托管服务。

重载

名称 说明
AddServiceEndpoint(Type, Binding, String)

使用指定的协定、绑定和终结点地址将服务终结点添加到托管服务。

AddServiceEndpoint(Type, Binding, Uri)

使用包含终结点地址的指定协定、绑定和 URI 将服务终结点添加到托管服务。

AddServiceEndpoint(Type, Binding, String, Uri)

使用指定的协定、绑定、终结点地址和服务侦听的 URI 将服务终结点添加到托管服务。

AddServiceEndpoint(Type, Binding, Uri, Uri)

使用指定的协定、绑定、包含终结点地址的 URI 以及服务侦听的 URI 将服务终结点添加到托管服务。

AddServiceEndpoint(Type, Binding, String)

使用指定的协定、绑定和终结点地址将服务终结点添加到托管服务。

public:
 System::ServiceModel::Description::ServiceEndpoint ^ AddServiceEndpoint(Type ^ implementedContract, System::ServiceModel::Channels::Binding ^ binding, System::String ^ address);
public System.ServiceModel.Description.ServiceEndpoint AddServiceEndpoint(Type implementedContract, System.ServiceModel.Channels.Binding binding, string address);
override this.AddServiceEndpoint : Type * System.ServiceModel.Channels.Binding * string -> System.ServiceModel.Description.ServiceEndpoint
Public Function AddServiceEndpoint (implementedContract As Type, binding As Binding, address As String) As ServiceEndpoint

参数

implementedContract
Type

Type已添加终结点的协定。

binding
Binding

Binding添加的终结点。

address
String

添加的终结点的地址。

返回

ServiceEndpoint添加到托管服务。

例外

implementedContractbindingaddressnull.

示例

WSHttpBinding binding = new WSHttpBinding();
serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, "http://localhost:8000/servicemodelsamples/service/basic");
Dim binding As BasicHttpBinding = New BasicHttpBinding()
serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, "http://localhost:8000/servicemodelsamples/service/basic")

适用于

AddServiceEndpoint(Type, Binding, Uri)

使用包含终结点地址的指定协定、绑定和 URI 将服务终结点添加到托管服务。

public:
 System::ServiceModel::Description::ServiceEndpoint ^ AddServiceEndpoint(Type ^ implementedContract, System::ServiceModel::Channels::Binding ^ binding, Uri ^ address);
public System.ServiceModel.Description.ServiceEndpoint AddServiceEndpoint(Type implementedContract, System.ServiceModel.Channels.Binding binding, Uri address);
override this.AddServiceEndpoint : Type * System.ServiceModel.Channels.Binding * Uri -> System.ServiceModel.Description.ServiceEndpoint
Public Function AddServiceEndpoint (implementedContract As Type, binding As Binding, address As Uri) As ServiceEndpoint

参数

implementedContract
Type

Type已添加终结点的协定。

binding
Binding

Binding添加的终结点。

address
Uri

Uri包含添加的终结点的地址的地址。

返回

ServiceEndpoint添加到托管服务。

例外

implementedContractbindingaddressnull.

示例

BasicHttpBinding binding = new BasicHttpBinding();
Uri address = new Uri("http://localhost:8000/servicemodelsamples/service/basic");
serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, address);
Dim binding As BasicHttpBinding = New BasicHttpBinding()
Dim address As Uri = New Uri("http://localhost:8000/servicemodelsamples/service/basic")
serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address)

适用于

AddServiceEndpoint(Type, Binding, String, Uri)

使用指定的协定、绑定、终结点地址和服务侦听的 URI 将服务终结点添加到托管服务。

public:
 System::ServiceModel::Description::ServiceEndpoint ^ AddServiceEndpoint(Type ^ implementedContract, System::ServiceModel::Channels::Binding ^ binding, System::String ^ address, Uri ^ listenUri);
public System.ServiceModel.Description.ServiceEndpoint AddServiceEndpoint(Type implementedContract, System.ServiceModel.Channels.Binding binding, string address, Uri listenUri);
override this.AddServiceEndpoint : Type * System.ServiceModel.Channels.Binding * string * Uri -> System.ServiceModel.Description.ServiceEndpoint
Public Function AddServiceEndpoint (implementedContract As Type, binding As Binding, address As String, listenUri As Uri) As ServiceEndpoint

参数

implementedContract
Type

Type已添加终结点的协定。

binding
Binding

Binding添加的终结点。

address
String

服务的终结点地址。

listenUri
Uri

Uri服务终结点可以侦听的服务终结点。

返回

ServiceEndpoint添加到托管服务。

例外

implementedContractbindingaddressnull.

示例

BasicHttpBinding binding = new BasicHttpBinding();
Uri listenUri = new Uri("http://localhost:8000/MyListenUri");
string address = "http://localhost:8000/servicemodelsamples/service2";
serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, address, listenUri);
Dim binding As BasicHttpBinding = New BasicHttpBinding()
Dim listenUri As Uri = New Uri("http://localhost:8000/MyListenUri")
Dim address As String = "http://localhost:8000/servicemodelsamples/service/basic"
serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address, listenUri)

注解

如果有多个终结点需要侦听同一指定的 URI,请使用此方法的版本。

适用于

AddServiceEndpoint(Type, Binding, Uri, Uri)

使用指定的协定、绑定、包含终结点地址的 URI 以及服务侦听的 URI 将服务终结点添加到托管服务。

public:
 System::ServiceModel::Description::ServiceEndpoint ^ AddServiceEndpoint(Type ^ implementedContract, System::ServiceModel::Channels::Binding ^ binding, Uri ^ address, Uri ^ listenUri);
public System.ServiceModel.Description.ServiceEndpoint AddServiceEndpoint(Type implementedContract, System.ServiceModel.Channels.Binding binding, Uri address, Uri listenUri);
override this.AddServiceEndpoint : Type * System.ServiceModel.Channels.Binding * Uri * Uri -> System.ServiceModel.Description.ServiceEndpoint
Public Function AddServiceEndpoint (implementedContract As Type, binding As Binding, address As Uri, listenUri As Uri) As ServiceEndpoint

参数

implementedContract
Type

Type已添加终结点的协定。

binding
Binding

Binding添加的终结点。

address
Uri

Uri包含添加的终结点的地址的地址。

listenUri
Uri

Uri服务终结点可以侦听的服务终结点。

返回

ServiceEndpoint添加到托管服务。

例外

implementedContractbindingaddressnull.

未初始化协定或找不到协定密钥。

示例

BasicHttpBinding binding = new BasicHttpBinding();
Uri listenUri = new Uri("http://localhost:8000/MyListenUri");
Uri address = new Uri("http://localhost:8000/servicemodelsamples/service3");
serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, address, listenUri);
Dim binding As BasicHttpBinding = New BasicHttpBinding()
Dim listenUri As Uri = New Uri("http://localhost:8000/MyListenUri")
Dim address As Uri = New Uri("http://localhost:8000/servicemodelsamples/service/basic")
serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address, listenUri)

注解

如果有多个终结点需要侦听同一指定的 URI,请使用此方法的版本。

适用于