Export (0) Print
Expand All

ServiceHostBase.AddServiceEndpoint Method (String, Binding, String)

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

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

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

Parameters

implementedContract

The contract implemented by the endpoint.

binding

The Binding for the endpoint added.

address

The String that contains the address for the endpoint added. This could be an absolute or relative URI. If it is a relative URI, one of the base address of the ServiceHost (depending on the binding protocol) is used as the endpoint's base address.

Return Value

The ServiceEndpoint added to the hosted service.

Exception typeCondition

ArgumentNullException

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

InvalidOperationException

The host is not in a Created or an Opening state or there is no ServiceDescription for the hosted service and so an endpoint cannot be added or the binding lacks a transport of binding scheme.

  NetTcpBinding portsharingBinding = new NetTcpBinding();
  hostDefault.AddServiceEndpoint(
typeof( CalculatorService ),
portsharingBinding,
"net.tcp://localhost/MyService" );


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:
© 2014 Microsoft