EndpointAddress 클래스

정의

클라이언트가 서비스 엔드포인트와 통신하는 데 사용하는 고유한 네트워크 주소를 제공합니다.

public ref class EndpointAddress
public class EndpointAddress
type EndpointAddress = class
Public Class EndpointAddress
상속
EndpointAddress

예제

using System;
using System.Configuration;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;

using System.Text;

namespace Microsoft.WCF.Documentation
{
  class HostApplication
  {

    static void Main()
    {
      HostApplication app = new HostApplication();
      app.Run();
    }

    private void Run()
    {

            // Get base address from app settings in configuration
            Uri baseAddress = new Uri(ConfigurationManager.AppSettings["baseAddress"]);

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

            // Enumerate address headers and their properties from the array.
            AddressHeader[] addressHeaders = new AddressHeader[2] { addressHeader1, addressHeader2 };
            foreach (AddressHeader addressHeader in addressHeaders)
            {
                Console.WriteLine("AddressHeader - namespace:\t\t{0}", addressHeader.Namespace);
                Console.WriteLine("              - name:\t\t\t{0}", addressHeader.Name);
                Console.WriteLine("              - value:\t\t\t{0}", addressHeader.GetValue<int>());
                Console.WriteLine("              - type:\t\t\t{0}", addressHeader.GetType());
                Console.WriteLine("              - hashcode:\t\t{0}", addressHeader.GetHashCode());
                Console.WriteLine("              - equals addressHeader1:\t{0}", addressHeader.Equals(addressHeader1));
             //   Console.WriteLine("              - Is SOAP1.1 supported:\t{0}", addressHeader.ToMessageHeader().IsMessageVersionSupported(MessageVersion.WSAddressingSoap10));
                Console.WriteLine();
            }
            Console.WriteLine();

            //Add the array of address headers to an endpoint address
            EndpointAddress endpointAddress = new EndpointAddress(
                        new Uri("http://localhost:8003/servicemodelsamples/service"), addressHeaders);

            //Create a "special" service endpoint that uses the endpointAddress.
            string WSHttpBindingName = "Binding1";
            ServiceEndpoint specialServiceEndpoint = new ServiceEndpoint(
                ContractDescription.GetContract(typeof(CalculatorService)), new WSHttpBinding(WSHttpBindingName), endpointAddress
                );

            // Create a ServiceHost for the CalculatorService type that uses the base address.
            ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

            //Add the specialServiceEndpoint to the serviceHost.
            serviceHost.Description.Endpoints.Add(specialServiceEndpoint);

            // Enumerate the service endpoints and some of their properties from the serviceHost.
            Console.WriteLine("Service endpoints:");
            ServiceDescription desc = serviceHost.Description;
            foreach (ServiceEndpoint endpoint in desc.Endpoints)
            {
                Console.WriteLine("Endpoint - address:  {0}", endpoint.Address);
                Console.WriteLine("         - binding name:\t\t{0}", endpoint.Binding.Name);
                // Console.WriteLine("         - binding name:\t\t{0}", endpoint.);
                Console.WriteLine("         - contract name:\t\t{0}", endpoint.Contract.Name);
                Console.WriteLine("         - contains addressHeader1:\t{0}", endpoint.Address.Headers.Contains(addressHeader1));
                Console.WriteLine("         - count of address headers:\t{0}", endpoint.Address.Headers.Count);
                Console.WriteLine();
            }

            Console.WriteLine();

            // Open the ServiceHostBase to create listeners and start listening for messages.
            serviceHost.Open();

            // The service can now be accessed.
            Console.WriteLine("The service is ready.");
            Console.WriteLine("Press <ENTER> to terminate service.");
            Console.WriteLine();
            Console.ReadLine();

            // Close the ServiceHostBase to shutdown the service.
            serviceHost.Close();
        }
    }
  }

설명

엔드포인트 주소는 서비스의 엔드포인트를 고유하게 식별합니다.

엔드포인트 주소는 엔드포인트에 대한 바인딩, 계약 및 동작도 포함하는 서비스 엔드포인트에 속합니다.

ID EndpointAddress , WSDL 요소 및 선택적 헤더 컬렉션을 포함하는 URI 및 주소 속성이 포함됩니다. 선택적 헤더는 엔드포인트를 식별하거나 상호 작용하는 추가적인 보다 자세한 주소 지정 정보를 제공하는 데 사용됩니다. 예를 들어 여러 인스턴스를 사용할 수 있을 때 특정 사용자로부터 들어오는 메시지를 처리하는 데 사용할 서비스 인스턴스를 나타내는 데 사용할 수 있습니다.

서비스의 엔드포인트 주소는 명령적으로 코드를 사용하거나 구성을 통해 선언적으로 지정할 수 있습니다. 배포된 서비스에 대한 바인딩 및 주소는 일반적으로 서비스를 개발하는 동안 사용되는 것과 다르기 때문에 코드에서 엔드포인트를 정의하는 것은 일반적으로 실용적이지 않습니다. 구성을 사용하여 서비스 엔드포인트를 정의하는 것이 더 실용적입니다.

EndpointAddress 는 인터페이스를 ISerializable 구현하지 않으므로 직렬화할 수 없습니다. 엔드포인트가 서비스 계약의 일부로 노출되려면 직렬화할 수 있어야 하며 웹 서비스 주소 지정(WS-Addressing) 프로토콜도 준수해야 합니다. 버전 1.0 및 2004년 8월 버전의 WS-Addressing 준수하는 직렬화 가능한 엔드포인트는 각각 및 EndpointAddress10 클래스에서 EndpointAddressAugust2004 제공됩니다.

생성자

Name Description
EndpointAddress(String)

지정된 URI 문자열을 사용하여 클래스의 EndpointAddress 새 인스턴스를 초기화합니다.

EndpointAddress(Uri, AddressHeader[])

지정된 URI 및 헤더를 EndpointAddress 사용하여 클래스의 새 인스턴스를 초기화합니다.

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

지정된 URI, ID 및 헤더를 EndpointAddress 사용하여 클래스의 새 인스턴스를 초기화합니다.

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

지정된 URI, ID, 헤더 컬렉션, 메타데이터 및 확장 판독기를 사용하여 클래스의 EndpointAddress 새 인스턴스를 초기화합니다.

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

지정된 URI, ID 및 헤더 컬렉션을 사용하여 클래스의 EndpointAddress 새 인스턴스를 초기화합니다.

속성

Name Description
AnonymousUri

익명 URI의 버전 중립적 표현을 가져옵니다.

Headers

작성기에서 만들 수 있는 엔드포인트에 대한 주소 헤더 컬렉션을 가져옵니다.

Identity

인증하는 데 사용되는 엔드포인트의 ID를 가져옵니다.

IsAnonymous

엔드포인트가 익명인지 여부를 나타내는 값을 가져옵니다.

IsNone

엔드포인트 NoneUri에 대한 URI가 .인지 여부를 나타내는 값을 가져옵니다.

NoneUri

메시지를 보내지 않아야 하는 엔드포인트의 주소에 사용되는 버전 중립 URI를 가져옵니다.

Uri

엔드포인트의 URI를 가져옵니다.

메서드

Name Description
ApplyTo(Message)

지정된 메시지의 헤더 값에 엔드포인트 주소의 URI 및 속성을 할당합니다.

Equals(Object)

지정된 개체가 현재 엔드포인트 주소와 같은지 여부를 나타내는 값을 반환합니다.

GetHashCode()

현재 엔드포인트 주소에 대한 고유한 해시 코드를 제공합니다.

GetReaderAtExtensions()

확장에 대한 액세스를 제공하는 XML 사전 판독기를 가져옵니다.

GetReaderAtMetadata()

엔드포인트에 대한 메타데이터에 대한 액세스를 제공하는 XML 사전 판독기를 가져옵니다.

GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ReadFrom(AddressingVersion, XmlDictionaryReader, XmlDictionaryString, XmlDictionaryString)

지정된 XML 사전 판독기에서 지정된 정규화된 이름을 가진 지정된 주소 버전의 엔드포인트 주소를 읽습니다.

ReadFrom(AddressingVersion, XmlDictionaryReader)

지정된 XML 사전 판독기에서 지정된 주소 버전의 엔드포인트 주소를 읽습니다.

ReadFrom(AddressingVersion, XmlReader, String, String)

지정된 XML 판독기에서 지정된 정규화된 이름을 가진 지정된 주소 버전의 엔드포인트 주소를 읽습니다.

ReadFrom(AddressingVersion, XmlReader)

지정된 XML 판독기에서 지정된 주소 버전의 엔드포인트 주소를 읽습니다.

ReadFrom(XmlDictionaryReader, XmlDictionaryString, XmlDictionaryString)

지정된 XML 사전 판독기에서 지정된 정규화된 이름의 엔드포인트 주소를 읽습니다.

ReadFrom(XmlDictionaryReader)

지정된 XML 사전 판독기에서 엔드포인트 주소를 읽습니다.

ToString()

엔드포인트 주소에 포함된 URI의 정식 문자열 표현을 반환합니다.

WriteContentsTo(AddressingVersion, XmlDictionaryWriter)

노드의 모든 자식 노드를 지정된 XML 사전 작성기에 저장합니다.

WriteContentsTo(AddressingVersion, XmlWriter)

노드의 모든 자식 노드를 지정된 XML 기록기에 저장합니다.

WriteTo(AddressingVersion, XmlDictionaryWriter, XmlDictionaryString, XmlDictionaryString)

지정된 버전의 현재 엔드포인트 주소를 지정된 네임스페이스와 로컬 이름을 가진 XML 사전 작성기에 저장합니다.

WriteTo(AddressingVersion, XmlDictionaryWriter)

지정된 버전의 현재 엔드포인트 주소를 지정된 XML 사전 작성기에 저장합니다.

WriteTo(AddressingVersion, XmlWriter, String, String)

지정된 버전의 현재 엔드포인트 주소를 지정된 네임스페이스와 로컬 이름을 가진 XML 기록기에 저장합니다.

WriteTo(AddressingVersion, XmlWriter)

지정된 버전의 현재 엔드포인트 주소를 지정된 XML 기록기에 저장합니다.

연산자

Name Description
Equality(EndpointAddress, EndpointAddress)

지정된 엔드포인트 주소가 동일하지 않은지 여부를 나타내는 값을 반환합니다.

Inequality(EndpointAddress, EndpointAddress)

지정된 엔드포인트 주소가 동일하지 않은지 여부를 나타내는 값을 반환합니다.

적용 대상