Freigeben über


EndpointAddress Constructor (Uri, array<AddressHeader[])

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Sub New ( _
    uri As Uri, _
    ParamArray addressHeaders As AddressHeader() _
)
public EndpointAddress(
    Uri uri,
    params AddressHeader[] addressHeaders
)

Parameters

  • uri
    Type: System.Uri
    The Uri that identifies the endpoint location.

Examples

            ' Create new address headers for special services and add them to an array
            Dim addressHeader1 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice1", "https://localhost:8000/service", 1)
            Dim addressHeader2 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice2", "https://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("https://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)
// Create new address headers for special services and add them to an array
AddressHeader addressHeader1 = AddressHeader.CreateAddressHeader("specialservice1", "https://localhost:8000/service", 1);
AddressHeader addressHeader2 = AddressHeader.CreateAddressHeader("specialservice2", "https://localhost:8000/service", 2);
AddressHeader[] addressHeaders1 = new AddressHeader[2] { addressHeader1, addressHeader2 };

// Endpoint address constructor with URI and address headers
EndpointAddress endpointAddressWithHeaders = new EndpointAddress(
    new Uri("https://localhost/silverlightsamples/service2"), addressHeaders1
    );

// Confirm adddressHeader1 is in endpointAddressWithHeaders - boolHeaders returns True.
AddressHeaderCollection addressHeaderCollection = endpointAddressWithHeaders.Headers;
bool boolHeaders = addressHeaderCollection.Contains(addressHeader1);

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.