EndpointAddress Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Provides a unique network address that a client uses to communicate with a service endpoint.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The EndpointAddress type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | EndpointAddress(String) | Initializes a new instance of the EndpointAddress class with a specified URI string. |
![]() | EndpointAddress(Uri, AddressHeader()) | Initializes a new instance of the EndpointAddress class with a specified URI and headers. |
| Name | Description | |
|---|---|---|
![]() ![]() | AnonymousUri | Gets a version-neutral representation of the anonymous URI. |
![]() | Headers | Gets the collection of address headers for the endpoints that the builder can create. |
![]() | IsAnonymous | Gets a value that indicates whether the endpoint is anonymous. |
![]() | IsNone | Gets a value that indicates whether the URI for the endpoint is the NoneUri. |
![]() ![]() | NoneUri | Gets a version-neutral URI used for the address of an endpoint to which a message must not be sent. |
![]() | Uri | Gets the URI for the endpoint. |
| Name | Description | |
|---|---|---|
![]() | ApplyTo | Assigns the URI and properties of the endpoint address to the values of the headers of a specified message. |
![]() | Equals | Returns a value that indicates whether a specified object is equivalent to the current endpoint address. (Overrides Object.Equals(Object).) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Provides a unique hash code for the current endpoint address. (Overrides Object.GetHashCode.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | ReadFrom | Reads an endpoint address for a specified address version from a specified XML dictionary reader. |
![]() | ToString | Returns a canonical string representation of the URI that is contained in the endpoint address. (Overrides Object.ToString.) |
![]() | WriteContentsTo | Saves all the child nodes of the node to the XML dictionary writer specified. |
| Name | Description | |
|---|---|---|
![]() ![]() | Equality | Returns a value that indicates whether specified endpoint addresses are not equivalent. |
![]() ![]() | Inequality | Returns a value that indicates whether specified endpoint addresses are not equivalent. |
An endpoint address uniquely identifies the endpoint for a service.
The endpoint address belongs to the service endpoint, which also contains the binding, contract and behaviors for the endpoint.
The EndpointAddress contains a URI and address properties that include an identity, WSDL elements, and a collection of optional headers. The optional headers are used to provide additional, more detailed addressing information to identify or interact with the endpoint. For example, they can be used to indicate which instance of a service is to be used to process an incoming message from a particular user when multiple instances are available.
Capabilities
If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.
ID_CAP_NETWORKING | Windows Phone 8, Windows Phone OS 7.1 |
For more info, see App capabilities and hardware requirements for Windows Phone 8.
' Endpoint address constructor with URI only Dim endpointAddress As New EndpointAddress(New Uri("http://localhost/silverlightsamples/service1")) ' Create new address headers for special services and add them to an array Dim addressHeader1 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1) Dim addressHeader2 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2) Dim addressHeaders1() As AddressHeader = { addressHeader1, addressHeader2 } ' Endpoint address constructor with URI and address headers Dim endpointAddressWithHeaders As New EndpointAddress(New Uri("http://localhost/silverlightsamples/service2"), addressHeaders1) ' Confirm adddressHeader1 is in endpointAddressWithHeaders - boolHeaders returns True. Dim addressHeaderCollection As AddressHeaderCollection = endpointAddressWithHeaders.Headers Dim boolHeaders As Boolean = addressHeaderCollection.Contains(addressHeader1) ' Endpoint address with the anonymous URI. Dim anonUri As Uri = EndpointAddress.AnonymousUri Dim anonUriEndpointAddress As New EndpointAddress(anonUri) 'Confirm the address is anonymous Dim boolAnonUri1 As Boolean = anonUriEndpointAddress.IsAnonymous 'Use Headers property to create a collection of address headers from the EnpointAddress Dim addressHeader3 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice3", "http://localhost:8000/service", 1) Dim addressHeader4 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice4", "http://localhost:8000/service", 2) Dim addressHeaders2() As AddressHeader = { addressHeader3, addressHeader4 } Dim endpointAddressWithHeaders2 As New EndpointAddress(New Uri("http://localhost/silverlightsamples/service3"), addressHeaders2) Dim addressHeaderCollection2 As AddressHeaderCollection = endpointAddressWithHeaders.Headers ' Confirm endpoint address has an anonymous URI. Dim anonEndpointAddress As New EndpointAddress(EndpointAddress.AnonymousUri) Dim boolAnonUri2 As Boolean = anonEndpointAddress.IsAnonymous ' Endpoint address with the none URI. Dim noneUri As Uri = EndpointAddress.NoneUri Dim noneUriEndpointAddress As New EndpointAddress(noneUri) 'Confirm the address is anonymous Dim boolNoneUri As Boolean = noneUriEndpointAddress.IsNone ' Get the URI from the endpoint address Dim endpointAddress1 As New EndpointAddress(New Uri("http://localhost/silverlightsamples/service1")) Dim endpointAddressUri As Uri = endpointAddress1.Uri ' Dim addressHeader5 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice5", "http://localhost:8000/service", 2) Dim endpointAddress2 As New EndpointAddress(New Uri("http://localhost/silverlightsamples/service1"), addressHeader5) Dim message As Message = Message.CreateMessage(MessageVersion.Soap11, Nothing) endpointAddress2.ApplyTo(message) Dim messageHeaders As MessageHeaders = message.Headers




