Export (0) Print
Expand All

ServiceHostBase.AddServiceEndpoint Method (ServiceEndpoint)

Adds the specified service endpoint to the hosted service.

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

public virtual void AddServiceEndpoint(
	ServiceEndpoint endpoint


Type: System.ServiceModel.Description.ServiceEndpoint

The service endpoint.


Endpoint is null.


The host is not in a Created or an Opening state or there is no ServiceDescription for the hosted service.


The Address, Binding, or Contract property is null.

When using the method, the service host does a "by-configuration-name" validation on the contract description. In other words, the host verifies that ConfigurationName exists in the list of configuration names of the service contracts implemented by the service. If the validation passes, the description in the ServiceEndpoint is used as it is, even if the ContractDescription reflected from the service is different.

As an example, assume that the description in the ServiceEndpoint and the contract description reflected from the service have the same name, but different operation behaviors. The implication of only “by-configuration-name” validation is that there is no validation that the behaviors are the same and there are one updates to one description because of another description.

If the address is a relative URI, one of the base addresses of the ServiceHost (depending on the binding protocol) is used as the endpoint's base address.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft