0 out of 1 rated this helpful - Rate this topic

ServiceEndpoint Class

Represents the endpoint for a service that allows clients of the service to find and communicate with the service.

Namespace:  System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)
public class ServiceEndpoint

The ServiceEndpoint type exposes the following members.

  Name Description
Public method Supported by Portable Class Library ServiceEndpoint(ContractDescription) Initializes a new instance of the ServiceEndpoint class for a specified contract.
Public method Supported by Portable Class Library ServiceEndpoint(ContractDescription, Binding, EndpointAddress) Initializes a new instance of the ServiceEndpoint class with a specified contract, binding, and address.
Top
  Name Description
Public property Supported by Portable Class Library Address Gets or sets the endpoint address for the service endpoint.
Public property Behaviors Gets the behaviors for the service endpoint.
Public property Supported by Portable Class Library Binding Gets or sets the binding for the service endpoint.
Public property Supported by Portable Class Library Contract Gets the contract for the service endpoint.
Public property IsSystemEndpoint Gets or sets whether the service endpoint is generated by the system as opposed to being user-defined.
Public property ListenUri Gets or sets the URI at which the service endpoint listens.
Public property ListenUriMode Gets or sets how the transport handles the URI that is provided for the service to listen on.
Public property Supported by Portable Class Library Name Gets or sets the name of the service endpoint.
Top
  Name Description
Public method Supported by Portable Class Library Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Supported by Portable Class Library Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method Supported by Portable Class Library GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method Supported by Portable Class Library GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method Supported by Portable Class Library MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Supported by Portable Class Library ToString Returns a string that represents the current object. (Inherited from Object.)
Top

The service endpoint contains the information about the address, binding, contract, and behavior required by a client to find and interact with the service at this endpoint.


Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

ContractDescription cd = new ContractDescription("Calculator");
ServiceEndpoint svcEndpoint = new ServiceEndpoint(cd);

ServiceEndpoint endpnt = serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

Console.WriteLine("Address: {0}", endpnt.Address);

// Enable Mex
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
serviceHost.Description.Behaviors.Add(smb);

serviceHost.Open();


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Is the code sample correct?
The code sample doesn't use the svcEndpoint variable it creates? Is this a copy/paste error from a different sample?


[tfl - 06 01 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead,
you should visit the MSDN Forums at http://forums.microsoft.com/MSDN, where such posts are welcomed and where you stand a much
better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.