ServiceEndpoint.Name 속성

정의

서비스 엔드포인트의 이름을 가져오거나 설정합니다.

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

속성 값

서비스 엔드포인트의 이름입니다. 기본값은 바인딩 이름과 계약 설명 이름을 연결한 값입니다. 예를 들면 Name +'_' + Name입니다.

예제

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

Console.WriteLine("Service endpoint {0} contains the following:", endpoint.Name);
Console.WriteLine("Binding: {0}", endpoint.Binding.ToString());
Console.WriteLine("Contract: {0}", endpoint.Contract.ToString());
Console.WriteLine("ListenUri: {0}", endpoint.ListenUri.ToString());
Console.WriteLine("ListenUriMode: {0}", endpoint.ListenUriMode.ToString());
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

Dim endpoint As ServiceEndpoint = serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

Console.WriteLine("Service endpoint {0} contains the following:", endpoint.Name)
Console.WriteLine("Binding: {0}", endpoint.Binding.ToString())
Console.WriteLine("Contract: {0}", endpoint.Contract.ToString())
Console.WriteLine("ListenUri: {0}", endpoint.ListenUri.ToString())
Console.WriteLine("ListenUriMode: {0}", endpoint.ListenUriMode.ToString())

설명

서비스에는 여러 엔드포인트가 있을 수 있으므로 엔드포인트 Name 는 서비스의 이름과 다릅니다. 서비스 이름은 속성을 사용하여 액세스됩니다 Name .

참고

서비스에서 액세스하면 이 속성은 endpoint name="endpointName"> 구성 요소로 <채워집니다. 클라이언트에서 액세스하면 이 속성은 입니다 null. 속성 getter가 호출되면(클라이언트에서 다시) 계약 및 바인딩에 따라 이 속성을 기본값으로 채웁니다.

적용 대상