EndpointAddress 建構函式

定義

初始化 EndpointAddress 類別的新執行個體。

多載

EndpointAddress(String)

使用指定的 URI 字串,初始化 EndpointAddress 類別的新執行個體。

EndpointAddress(Uri, AddressHeader[])

使用指定的 URI 和標頭,初始化 EndpointAddress 類別的新執行個體。

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

使用指定的 URI、身分識別和標頭,初始化 EndpointAddress 類別的新執行個體。

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

使用指定的 URI、身分識別和標頭集合,初始化 EndpointAddress 類別的新執行個體。

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

使用指定的 URI、身分識別、標頭集合以及中繼資料和延伸讀取器,初始化 EndpointAddress 類別的新執行個體。

EndpointAddress(String)

使用指定的 URI 字串,初始化 EndpointAddress 類別的新執行個體。

public:
 EndpointAddress(System::String ^ uri);
public EndpointAddress (string uri);
new System.ServiceModel.EndpointAddress : string -> System.ServiceModel.EndpointAddress
Public Sub New (uri As String)

參數

uri
String

識別端點的 URI。

範例

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;

適用於

EndpointAddress(Uri, AddressHeader[])

使用指定的 URI 和標頭,初始化 EndpointAddress 類別的新執行個體。

public:
 EndpointAddress(Uri ^ uri, ... cli::array <System::ServiceModel::Channels::AddressHeader ^> ^ addressHeaders);
public EndpointAddress (Uri uri, params System.ServiceModel.Channels.AddressHeader[] addressHeaders);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.Channels.AddressHeader[] -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, ParamArray addressHeaders As AddressHeader())

參數

uri
Uri

識別端點位置的 Uri

addressHeaders
AddressHeader[]

型別 ArrayAddressHeader,其中包含用於與端點互動的位址資訊。

範例

下列程式碼會示範這個建構函式的用法。

適用於

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

使用指定的 URI、身分識別和標頭,初始化 EndpointAddress 類別的新執行個體。

public:
 EndpointAddress(Uri ^ uri, System::ServiceModel::EndpointIdentity ^ identity, ... cli::array <System::ServiceModel::Channels::AddressHeader ^> ^ addressHeaders);
public EndpointAddress (Uri uri, System.ServiceModel.EndpointIdentity identity, params System.ServiceModel.Channels.AddressHeader[] addressHeaders);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.EndpointIdentity * System.ServiceModel.Channels.AddressHeader[] -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, identity As EndpointIdentity, ParamArray addressHeaders As AddressHeader())

參數

uri
Uri

識別端點位置的 Uri

identity
EndpointIdentity

端點的 EndpointIdentity

addressHeaders
AddressHeader[]

型別 ArrayAddressHeader,其中包含用於與端點互動的位址資訊。

範例

下列程式碼將示範如何建構包含 EndpointAddress, UriEndpointIdentity 物件,以及 AddressHeader 物件的陣列。

        //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);

適用於

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

使用指定的 URI、身分識別和標頭集合,初始化 EndpointAddress 類別的新執行個體。

public:
 EndpointAddress(Uri ^ uri, System::ServiceModel::EndpointIdentity ^ identity, System::ServiceModel::Channels::AddressHeaderCollection ^ headers);
public EndpointAddress (Uri uri, System.ServiceModel.EndpointIdentity identity, System.ServiceModel.Channels.AddressHeaderCollection headers);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.EndpointIdentity * System.ServiceModel.Channels.AddressHeaderCollection -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, identity As EndpointIdentity, headers As AddressHeaderCollection)

參數

uri
Uri

識別端點位置的 Uri

identity
EndpointIdentity

端點的 EndpointIdentity

headers
AddressHeaderCollection

AddressHeaderCollection,其中包含用於與端點互動的位址資訊。

範例

下列程式碼將示範如何建構包含 EndpointAddressUriEndpointIdentity 物件,以及 AddressHeaderCollection 物件的陣列。

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

適用於

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

使用指定的 URI、身分識別、標頭集合以及中繼資料和延伸讀取器,初始化 EndpointAddress 類別的新執行個體。

public:
 EndpointAddress(Uri ^ uri, System::ServiceModel::EndpointIdentity ^ identity, System::ServiceModel::Channels::AddressHeaderCollection ^ headers, System::Xml::XmlDictionaryReader ^ metadataReader, System::Xml::XmlDictionaryReader ^ extensionReader);
public EndpointAddress (Uri uri, System.ServiceModel.EndpointIdentity identity, System.ServiceModel.Channels.AddressHeaderCollection headers, System.Xml.XmlDictionaryReader metadataReader, System.Xml.XmlDictionaryReader extensionReader);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.EndpointIdentity * System.ServiceModel.Channels.AddressHeaderCollection * System.Xml.XmlDictionaryReader * System.Xml.XmlDictionaryReader -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, identity As EndpointIdentity, headers As AddressHeaderCollection, metadataReader As XmlDictionaryReader, extensionReader As XmlDictionaryReader)

參數

uri
Uri

識別端點位置的 Uri

identity
EndpointIdentity

端點的 EndpointIdentity

headers
AddressHeaderCollection

AddressHeaderCollection,其中包含用於與端點互動的位址資訊。

metadataReader
XmlDictionaryReader

從其中取得端點中繼資料的 XmlDictionaryReader

extensionReader
XmlDictionaryReader

從其中取得延伸的 XmlDictionaryReader

範例

下列程式碼會示範如何具現化會指定 EndpointAddressUri、標頭集合、中繼資料 EndpointIdentity 和延伸 XmlDictionaryReaderXmlDictionaryReader

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);

備註

WS-Addressing 規格允許任意延伸項目出現在可使用 XmlDictionaryReader 取得的端點參考 (EPR) 尾端。

適用於