ServiceHost.AddServiceEndpoint ServiceHost.AddServiceEndpoint ServiceHost.AddServiceEndpoint Method

Definition

Adds a service endpoint to the hosted service.

Overloads

AddServiceEndpoint(Type, Binding, String) AddServiceEndpoint(Type, Binding, String) AddServiceEndpoint(Type, Binding, String)

Adds a service endpoint to the hosted service with a specified contract, binding, and endpoint address.

AddServiceEndpoint(Type, Binding, Uri) AddServiceEndpoint(Type, Binding, Uri) AddServiceEndpoint(Type, Binding, Uri)

Adds a service endpoint to the hosted service with a specified contract, binding, and URI that contains the endpoint address.

AddServiceEndpoint(Type, Binding, String, Uri) AddServiceEndpoint(Type, Binding, String, Uri) AddServiceEndpoint(Type, Binding, String, Uri)

Adds a service endpoint to the hosted service with a specified contract, binding, an endpoint address, and a URI on which the service listens.

AddServiceEndpoint(Type, Binding, Uri, Uri) AddServiceEndpoint(Type, Binding, Uri, Uri) AddServiceEndpoint(Type, Binding, Uri, Uri)

Adds a service endpoint to the hosted service with a specified contract, binding, a URI that contains the endpoint address, and a URI on which the service listens.

AddServiceEndpoint(Type, Binding, String) AddServiceEndpoint(Type, Binding, String) AddServiceEndpoint(Type, Binding, String)

Adds a service endpoint to the hosted service with a specified contract, binding, and endpoint address.

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

Parameters

implementedContract
Type Type Type

The Type of contract for the endpoint added.

binding
Binding Binding Binding

The Binding for the endpoint added.

address
String String String

The address for the endpoint added.

Returns

Exceptions

implementedContract or binding or address is null.

Examples

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) AddServiceEndpoint(Type, Binding, Uri) AddServiceEndpoint(Type, Binding, Uri)

Adds a service endpoint to the hosted service with a specified contract, binding, and URI that contains the endpoint address.

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

Parameters

implementedContract
Type Type Type

The Type of contract for the endpoint added.

binding
Binding Binding Binding

The Binding for the endpoint added.

address
Uri Uri Uri

The Uri that contains the address for the endpoint added.

Returns

Exceptions

implementedContract or binding or address is null.

Examples

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) AddServiceEndpoint(Type, Binding, String, Uri) AddServiceEndpoint(Type, Binding, String, Uri)

Adds a service endpoint to the hosted service with a specified contract, binding, an endpoint address, and a URI on which the service listens.

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

Parameters

implementedContract
Type Type Type

The Type of contract for the endpoint added.

binding
Binding Binding Binding

The Binding for the endpoint added.

address
String String String

The endpoint address for the service.

listenUri
Uri Uri Uri

The Uri on which the service endpoints can listen.

Returns

Exceptions

implementedContract or binding or address is null.

Examples

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)

Remarks

Use this version of the method when you have multiple endpoints that need to listen on the same, specified URI.

AddServiceEndpoint(Type, Binding, Uri, Uri) AddServiceEndpoint(Type, Binding, Uri, Uri) AddServiceEndpoint(Type, Binding, Uri, Uri)

Adds a service endpoint to the hosted service with a specified contract, binding, a URI that contains the endpoint address, and a URI on which the service listens.

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

Parameters

implementedContract
Type Type Type

The Type of contract for the endpoint added.

binding
Binding Binding Binding

The Binding for the endpoint added.

address
Uri Uri Uri

The Uri that contains the address for the endpoint added.

listenUri
Uri Uri Uri

The Uri on which the service endpoints can listen.

Returns

Exceptions

implementedContract or binding or address is null.

The contracts are not initialized or the contract keys cannot be found.

Examples

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)

Remarks

Use this version of the method when you have multiple endpoints that need to listen on the same, specified URI.

Applies to