This documentation is archived and is not being maintained.

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

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

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

Parameters

implementedContract

The Type of contract for the endpoint added.

binding

The Binding for the endpoint added.

address

The endpoint address for the service.

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

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");
String address = "http://localhost:8000/servicemodelsamples/service2";
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
Show: