EndpointAddress Constructor (Uri, EndpointIdentity, AddressHeaderCollection)

 

Initializes a new instance of the EndpointAddress class with a specified URI, identity, and header collection.

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

public EndpointAddress(
	Uri uri,
	EndpointIdentity identity,
	AddressHeaderCollection headers
)

Parameters

uri
Type: System.Uri

The Uri that identifies the endpoint location.

identity
Type: System.ServiceModel.EndpointIdentity

The EndpointIdentity for the endpoint.

headers
Type: System.ServiceModel.Channels.AddressHeaderCollection

The AddressHeaderCollection that contains address information used to interact with the endpoint.

The following code shows how to construct a EndpointAddress object with a Uri, EndpointIdentity and an AddressHeaderCollection object.

       //Create new address headers for special services and add them to an array
       AddressHeader addressHeader1 = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1);
       AddressHeader addressHeader2 = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2);

       AddressHeader[] addressHeaders = new AddressHeader[2] { addressHeader1, addressHeader2 };
       AddressHeaderCollection addressHeaderColl = new AddressHeaderCollection(addressHeaders);

// <Snippet#15>
       EndpointIdentity endpointIdentity = EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);
       EndpointAddress endpointAddress = new EndpointAddress(
           new Uri("http://localhost:8003/servicemodelsamples/service/incode/identity"),
 endpointIdentity,
 addressHeaderColl);
EndpointIdentity thisEndpointIdentity = endpointAddress.Identity;
// </Snippet#15>

.NET Framework
Available since 3.0
Return to top
Show: