ServiceHost.AddServiceEndpoint Method (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.

Namespace: System.ServiceModel
Assembly: System.ServiceModel (in system.servicemodel.dll)

public ServiceEndpoint AddServiceEndpoint (
	Type implementedContract,
	Binding binding,
	Uri address,
	Uri listenUri
)
public ServiceEndpoint AddServiceEndpoint (
	Type implementedContract, 
	Binding binding, 
	Uri address, 
	Uri listenUri
)
public function AddServiceEndpoint (
	implementedContract : Type, 
	binding : Binding, 
	address : Uri, 
	listenUri : Uri
) : ServiceEndpoint
Not applicable.

Parameters

implementedContract

The Type of contract for the endpoint added.

binding

The Binding for the endpoint added.

address

The Uri that contains the address for the endpoint added.

listenUri

The Uri on which the service endpoints can listen.

Return Value

The ServiceEndpoint added to the hosted service.

Exception typeCondition

ArgumentNullException

implementedContract or binding or address is a null reference (Nothing in Visual Basic).

InvalidOperationException

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

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

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show: