EndpointAddress Constructors

Definition

Initializes a new instance of the EndpointAddress class.

Overloads

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.

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

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

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

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

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection, XmlDictionaryReader, XmlDictionaryReader)

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

EndpointAddress(String)

Source:
EndpointAddress.cs
Source:
EndpointAddress.cs

Initializes a new instance of the EndpointAddress class with a specified URI string.

C#
public EndpointAddress(string uri);

Parameters

uri
String

The URI that identifies the endpoint.

Examples

C#
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 headers = new AddressHeaderCollection(addressHeaders);

EndpointIdentity endpointIdentity =
    EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);
EndpointAddress endpointAddress = new EndpointAddress(
    new Uri
    ("http://localhost:8003/servicemodelsamples/service/incode/identity"),
    endpointIdentity, addressHeaders);

Uri anonUri = EndpointAddress.AnonymousUri;

Applies to

.NET 10 (package-provided) i druge verzije
Proizvod Verzije
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

EndpointAddress(Uri, AddressHeader[])

Source:
EndpointAddress.cs
Source:
EndpointAddress.cs

Initializes a new instance of the EndpointAddress class with a specified URI and headers.

C#
public EndpointAddress(Uri uri, params System.ServiceModel.Channels.AddressHeader[] addressHeaders);

Parameters

uri
Uri

The Uri that identifies the endpoint location.

addressHeaders
AddressHeader[]

The Array of type AddressHeader that contains address information used to interact with the endpoint.

Examples

The following code shows the use of this constructor.

Applies to

.NET 10 (package-provided) i druge verzije
Proizvod Verzije
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

Source:
EndpointAddress.cs
Source:
EndpointAddress.cs

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

C#
public EndpointAddress(Uri uri, System.ServiceModel.EndpointIdentity identity, params System.ServiceModel.Channels.AddressHeader[] addressHeaders);

Parameters

uri
Uri

The Uri that identifies the endpoint location.

identity
EndpointIdentity

The EndpointIdentity for the endpoint.

addressHeaders
AddressHeader[]

The Array of type AddressHeader that contains address information used to interact with the endpoint.

Examples

The following code shows how to construct an EndpointAddress object with a Uri, EndpointIdentity and an array of AddressHeader objects.

C#
        //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 };

        EndpointIdentity endpointIdentity = EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);

        EndpointAddress endpointAddress = new EndpointAddress(
            new Uri
        ("http://localhost:8003/servicemodelsamples/service/incode/identity"),
        endpointIdentity, addressHeaders);

Applies to

.NET 10 (package-provided) i druge verzije
Proizvod Verzije
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

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

C#
public EndpointAddress(Uri uri, System.ServiceModel.EndpointIdentity identity, System.ServiceModel.Channels.AddressHeaderCollection headers);

Parameters

uri
Uri

The Uri that identifies the endpoint location.

identity
EndpointIdentity

The EndpointIdentity for the endpoint.

headers
AddressHeaderCollection

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

Examples

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

C#
        //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>

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection, XmlDictionaryReader, XmlDictionaryReader)

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

C#
public EndpointAddress(Uri uri, System.ServiceModel.EndpointIdentity identity, System.ServiceModel.Channels.AddressHeaderCollection headers, System.Xml.XmlDictionaryReader metadataReader, System.Xml.XmlDictionaryReader extensionReader);

Parameters

uri
Uri

The Uri that identifies the endpoint location.

identity
EndpointIdentity

The EndpointIdentity for the endpoint.

headers
AddressHeaderCollection

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

metadataReader
XmlDictionaryReader

The XmlDictionaryReader from which the endpoint metadata is obtained.

extensionReader
XmlDictionaryReader

The XmlDictionaryReader from which extensions are obtained.

Examples

The following code shows how to instantiate a EndpointAddress that specifies a Uri, an EndpointIdentity, a headers collection, a metadata XmlDictionaryReader and an extension XmlDictionaryReader.

C#
XmlDictionaryReader metadataReader = endpointAddress.GetReaderAtMetadata();
XmlDictionaryReader extensionReader = endpointAddress.GetReaderAtExtensions();
EndpointIdentity identity = EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);

EndpointAddress endpointAddress2 = new EndpointAddress(
    new Uri("http://localhost:8003/servicemodelsamples/service/incode/identity"), identity, headers, metadataReader, extensionReader);

Remarks

The WS-Addressing specification allows for arbitrary extension elements to appear at the end of an Endpoint Reference (EPR) that can be obtained using an XmlDictionaryReader.

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1