ClientBase<TChannel> 생성자

정의

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

오버로드

ClientBase<TChannel>()

애플리케이션 구성 파일의 기본 대상 엔드포인트를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(InstanceContext, String, String)

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(InstanceContext, Binding, EndpointAddress)

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(String, String)

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(String, EndpointAddress)

지정된 대상 주소 및 엔드포인트 정보를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(InstanceContext, String)

지정된 콜백 서비스 및 엔드포인트 구성 정보를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(InstanceContext, String, EndpointAddress)

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(Binding, EndpointAddress)

지정된 바인딩 및 대상 주소를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(String)

애플리케이션 구성 파일에서 ClientBase<TChannel>에 의해 지정된 구성 정보를 사용하여 endpointConfigurationName 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(InstanceContext)

ClientBase<TChannel>를 이중 대화의 콜백 개체로 사용하여 callbackInstance 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(ServiceEndpoint)

지정된 ClientBase<TChannel>를 사용하여 ServiceEndpoint 클래스의 새 인스턴스를 초기화합니다.

ClientBase<TChannel>(InstanceContext, ServiceEndpoint)

지정된 ClientBase<TChannel>InstanceContext 개체를 사용하여 ServiceEndpoint 클래스의 새 인스턴스를 초기화합니다.

설명

애플리케이션 구성 파일에서 엔드포인트 정보 로부터 WCF 클라이언트 개체를 만들려면 사용 합니다. 생성자의 기본 함수는 형식 매개 변수가 대상 서비스 계약의 형식인 을 만드는 System.ServiceModel.ChannelFactory<TChannel> 것입니다.

ClientBase<TChannel>()

Source:
ClientBase.cs
Source:
ClientBase.cs
Source:
ClientBase.cs

애플리케이션 구성 파일의 기본 대상 엔드포인트를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase();
protected ClientBase ();
Protected Sub New ()

예외

구성 파일에 기본 엔드포인트 정보가 없거나, 파일에 엔드포인트가 둘 이상의 있거나, 구성 파일이 없는 경우

예제

다음 코드 예제에서는 클라이언트가 클래스를 확장 하는 클래스에서 SampleServiceClient 이 생성자를 사용 하는 방법을 보여 줍니다 ClientBase<TChannel> .

using System;
using System.ServiceModel;
using System.ServiceModel.Channels;

public class Client
{
  public static void Main()
  {
    // Picks up configuration from the config file.
    SampleServiceClient wcfClient = new SampleServiceClient();
    try
    {
        // Making calls.
        Console.WriteLine("Enter the greeting to send: ");
        string greeting = Console.ReadLine();
        Console.WriteLine("The service responded: " + wcfClient.SampleMethod(greeting));

        Console.WriteLine("Press ENTER to exit:");
        Console.ReadLine();

        // Done with service.
        wcfClient.Close();
        Console.WriteLine("Done!");
    }
    catch (TimeoutException timeProblem)
    {
      Console.WriteLine("The service operation timed out. " + timeProblem.Message);
      wcfClient.Abort();
      Console.Read();
    }
    catch(CommunicationException commProblem)
    {
      Console.WriteLine("There was a communication problem. " + commProblem.Message);
      wcfClient.Abort();
      Console.Read();
    }
  }
}


Imports System.ServiceModel
Imports System.ServiceModel.Channels

Public Class Client
  Public Shared Sub Main()
    ' Picks up configuration from the config file.
    Dim wcfClient As New SampleServiceClient()
    Try
        ' Making calls.
        Console.WriteLine("Enter the greeting to send: ")
            Dim greeting = Console.ReadLine()
        Console.WriteLine("The service responded: " & wcfClient.SampleMethod(greeting))

        Console.WriteLine("Press ENTER to exit:")
        Console.ReadLine()

        ' Done with service. 
        wcfClient.Close()
        Console.WriteLine("Done!")
    Catch timeProblem As TimeoutException
      Console.WriteLine("The service operation timed out. " & timeProblem.Message)
      wcfClient.Abort()
      Console.Read()
    Catch commProblem As CommunicationException
      Console.WriteLine("There was a communication problem. " & commProblem.Message)
      wcfClient.Abort()
      Console.Read()
    End Try
  End Sub
End Class

설명

이 생성자를 사용하여 서비스를 호출하는 WCF 클라이언트 개체를 만듭니다. 이 생성자는 애플리케이션 구성 파일의 형식 매개 변수를 대상 계약으로 사용하며 바인딩 및 주소 정보를 사용합니다.

적용 대상

ClientBase<TChannel>(InstanceContext, String, String)

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::InstanceContext ^ callbackInstance, System::String ^ endpointConfigurationName, System::String ^ remoteAddress);
protected ClientBase (System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.InstanceContext * string * string -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (callbackInstance As InstanceContext, endpointConfigurationName As String, remoteAddress As String)

매개 변수

callbackInstance
InstanceContext

클라이언트가 연결된 서비스로부터 메시지를 수신할 때 사용하는 콜백 개체입니다.

endpointConfigurationName
String

애플리케이션 구성 파일의 엔드포인트 이름입니다.

remoteAddress
String

서비스의 주소입니다.

예외

콜백 인스턴스, endpointConfigurationName 또는 remoteAddressnull입니다.

엔드포인트를 찾을 수 없거나 엔드포인트 계약이 잘못된 경우

설명

이 생성자를 사용하여 대상 서비스에 대한 콜백 계약을 구현하는 서비스 개체를 전달하고 애플리케이션 구성 파일의 엔드포인트 이름에서 대상 엔드포인트 정보를 확인합니다(대상 값은 클라이언트 <엔드포인트> 요소의 특성을 찾아 name 서 배치됨).

추가 정보

적용 대상

ClientBase<TChannel>(InstanceContext, Binding, EndpointAddress)

Source:
ClientBase.cs
Source:
ClientBase.cs
Source:
ClientBase.cs

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::InstanceContext ^ callbackInstance, System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ remoteAddress);
protected ClientBase (System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.InstanceContext * System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (callbackInstance As InstanceContext, binding As Binding, remoteAddress As EndpointAddress)

매개 변수

callbackInstance
InstanceContext

콜백 서비스입니다.

binding
Binding

서비스를 호출할 때 사용하는 바인딩입니다.

remoteAddress
EndpointAddress

서비스 엔드포인트의 주소입니다.

예외

콜백 인스턴스, binding 또는 remoteAddressnull입니다.

적용 대상

ClientBase<TChannel>(String, String)

Source:
ClientBase.cs
Source:
ClientBase.cs

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::String ^ endpointConfigurationName, System::String ^ remoteAddress);
protected ClientBase (string endpointConfigurationName, string remoteAddress);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : string * string -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (endpointConfigurationName As String, remoteAddress As String)

매개 변수

endpointConfigurationName
String

애플리케이션 구성 파일의 엔드포인트 이름입니다.

remoteAddress
String

서비스의 주소입니다.

예외

endpointConfigurationName 또는 remoteAddressnull인 경우

엔드포인트를 찾을 수 없거나 엔드포인트 계약이 잘못된 경우

설명

이 생성자를 사용하여 애플리케이션 구성 파일의 엔드포인트 이름(대상 값은 클라이언트 <엔드포인트 요소의 특성을 찾아서 배치됨) 및 지정된 주소에서 대상 엔드포인트> 정보를 확인할 수 있습니다.name

추가 정보

적용 대상

ClientBase<TChannel>(String, EndpointAddress)

Source:
ClientBase.cs
Source:
ClientBase.cs

지정된 대상 주소 및 엔드포인트 정보를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::String ^ endpointConfigurationName, System::ServiceModel::EndpointAddress ^ remoteAddress);
protected ClientBase (string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : string * System.ServiceModel.EndpointAddress -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (endpointConfigurationName As String, remoteAddress As EndpointAddress)

매개 변수

endpointConfigurationName
String

애플리케이션 구성 파일의 엔드포인트 이름입니다.

remoteAddress
EndpointAddress

서비스의 주소입니다.

예외

endpointConfigurationName 또는 remoteAddressnull인 경우

엔드포인트를 찾을 수 없거나 엔드포인트 계약이 잘못된 경우

설명

이 생성자를 사용하여 애플리케이션 구성 파일의 엔드포인트 이름(대상 값은 클라이언트 <엔드포인트 요소의 특성을 찾아서 배치됨) 및 지정된 주소에서 대상 엔드포인트> 정보를 확인할 수 있습니다.name

적용 대상

ClientBase<TChannel>(InstanceContext, String)

지정된 콜백 서비스 및 엔드포인트 구성 정보를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::InstanceContext ^ callbackInstance, System::String ^ endpointConfigurationName);
protected ClientBase (System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.InstanceContext * string -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (callbackInstance As InstanceContext, endpointConfigurationName As String)

매개 변수

callbackInstance
InstanceContext

클라이언트가 연결된 서비스로부터 메시지를 수신할 때 사용하는 콜백 개체입니다.

endpointConfigurationName
String

애플리케이션 구성 파일의 엔드포인트 이름입니다.

예외

콜백 인스턴스 또는 endpointConfigurationNamenull인 경우

엔드포인트를 찾을 수 없거나 엔드포인트 계약이 잘못된 경우

설명

대상 서비스의 콜백 계약을 구현하는 서비스 개체를 전달하고 클라이언트 애플리케이션 구성 파일에서 대상 엔드포인트 정보를 확인하려면 이 생성자를 사용합니다. 대상 값은 클라이언트 <엔드포인트> 요소의 특성을 찾아 name 서 찾을 수 있습니다.

적용 대상

ClientBase<TChannel>(InstanceContext, String, EndpointAddress)

ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::InstanceContext ^ callbackInstance, System::String ^ endpointConfigurationName, System::ServiceModel::EndpointAddress ^ remoteAddress);
protected ClientBase (System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.InstanceContext * string * System.ServiceModel.EndpointAddress -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (callbackInstance As InstanceContext, endpointConfigurationName As String, remoteAddress As EndpointAddress)

매개 변수

callbackInstance
InstanceContext

클라이언트가 연결된 서비스로부터 메시지를 수신할 때 사용하는 콜백 개체입니다.

endpointConfigurationName
String

애플리케이션 구성 파일의 엔드포인트 이름입니다.

remoteAddress
EndpointAddress

서비스의 주소입니다.

예외

콜백 인스턴스, endpointConfigurationName 또는 remoteAddressnull입니다.

엔드포인트를 찾을 수 없거나 엔드포인트 계약이 잘못된 경우

설명

이 생성자를 사용하여 대상 서비스에 대한 콜백 계약을 구현하는 서비스 개체를 전달하고 애플리케이션 구성 파일의 엔드포인트 이름에서 대상 엔드포인트 정보를 확인합니다(대상 값은 클라이언트 <엔드포인트> 요소의 특성을 찾아 name 서 배치됨).

추가 정보

적용 대상

ClientBase<TChannel>(Binding, EndpointAddress)

Source:
ClientBase.cs
Source:
ClientBase.cs
Source:
ClientBase.cs

지정된 바인딩 및 대상 주소를 사용하여 ClientBase<TChannel> 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::Channels::Binding ^ binding, System::ServiceModel::EndpointAddress ^ remoteAddress);
protected ClientBase (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.Channels.Binding * System.ServiceModel.EndpointAddress -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (binding As Binding, remoteAddress As EndpointAddress)

매개 변수

binding
Binding

서비스를 호출할 때 사용하는 바인딩입니다.

remoteAddress
EndpointAddress

서비스 엔드포인트의 주소입니다.

예외

binding 또는 remoteAddressnull인 경우

적용 대상

ClientBase<TChannel>(String)

Source:
ClientBase.cs
Source:
ClientBase.cs

애플리케이션 구성 파일에서 ClientBase<TChannel>에 의해 지정된 구성 정보를 사용하여 endpointConfigurationName 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::String ^ endpointConfigurationName);
protected ClientBase (string endpointConfigurationName);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : string -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (endpointConfigurationName As String)

매개 변수

endpointConfigurationName
String

애플리케이션 구성 파일의 엔드포인트 이름입니다.

예외

지정된 엔드포인트 정보가 null인 경우

엔드포인트를 찾을 수 없거나 엔드포인트 계약이 잘못된 경우

설명

애플리케이션 구성 파일에 대상 엔드포인트가 둘 이상인 경우 이 생성자를 사용합니다. 이 값은 클라이언트 <엔드포인트> 요소의 특성입니다name.

적용 대상

ClientBase<TChannel>(InstanceContext)

ClientBase<TChannel>를 이중 대화의 콜백 개체로 사용하여 callbackInstance 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::InstanceContext ^ callbackInstance);
protected ClientBase (System.ServiceModel.InstanceContext callbackInstance);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.InstanceContext -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (callbackInstance As InstanceContext)

매개 변수

callbackInstance
InstanceContext

클라이언트 애플리케이션이 연결된 서비스로부터 메시지를 수신할 때 사용하는 콜백 개체입니다.

예외

콜백 인스턴스가 null인 경우

구성 파일에 기본 엔드포인트 정보가 없거나, 파일에 엔드포인트가 둘 이상의 있거나, 구성 파일이 없는 경우

예제

다음 코드 예제에서는이 생성자를 사용 하는 방법을 보여 줍니다 SampleDuplexHelloClient 는 클래스는 서비스에서 메시지를 수신 대기 하는 콜백 개체를 전달 합니다.

using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Threading;

namespace Microsoft.WCF.Documentation
{
  [CallbackBehaviorAttribute(
   IncludeExceptionDetailInFaults= true,
    UseSynchronizationContext=true,
    ValidateMustUnderstand=true
  )]
  public class Client : SampleDuplexHelloCallback
  {
    AutoResetEvent waitHandle;

    public Client()
    {
      waitHandle = new AutoResetEvent(false);
    }

    public void Run()
    {
      // Picks up configuration from the configuration file.
      SampleDuplexHelloClient wcfClient
        = new SampleDuplexHelloClient(new InstanceContext(this), "WSDualHttpBinding_SampleDuplexHello");
      try
      {
        Console.ForegroundColor = ConsoleColor.White;
        Console.WriteLine("Enter a greeting to send and press ENTER: ");
        Console.Write(">>> ");
        Console.ForegroundColor = ConsoleColor.Green;
        string greeting = Console.ReadLine();
        Console.ForegroundColor = ConsoleColor.White;
        Console.WriteLine("Called service with: \r\n\t" + greeting);
        wcfClient.Hello(greeting);
        Console.WriteLine("Execution passes service call and moves to the WaitHandle.");
        this.waitHandle.WaitOne();
        Console.ForegroundColor = ConsoleColor.Blue;
        Console.WriteLine("Set was called.");
        Console.Write("Press ");
        Console.ForegroundColor = ConsoleColor.Red;
        Console.Write("ENTER");
        Console.ForegroundColor = ConsoleColor.Blue;
        Console.Write(" to exit...");
        Console.ReadLine();
      }
      catch (TimeoutException timeProblem)
      {
        Console.WriteLine("The service operation timed out. " + timeProblem.Message);
        Console.ReadLine();
      }
      catch (CommunicationException commProblem)
      {
        Console.WriteLine("There was a communication problem. " + commProblem.Message);
        Console.ReadLine();
      }
    }
    public static void Main()
    {
      Client client = new Client();
      client.Run();
    }

    public void Reply(string response)
    {
      Console.WriteLine("Received output.");
      Console.WriteLine("\r\n\t" + response);
      this.waitHandle.Set();
    }
  }
}

Imports System.ServiceModel
Imports System.ServiceModel.Channels
Imports System.Threading

Namespace Microsoft.WCF.Documentation
  <CallbackBehaviorAttribute(IncludeExceptionDetailInFaults:= True, UseSynchronizationContext:=True, ValidateMustUnderstand:=True)> _
  Public Class Client
      Implements SampleDuplexHelloCallback
    Private waitHandle As AutoResetEvent

    Public Sub New()
      waitHandle = New AutoResetEvent(False)
    End Sub

    Public Sub Run()
      ' Picks up configuration from the configuration file.
      Dim wcfClient As New SampleDuplexHelloClient(New InstanceContext(Me), "WSDualHttpBinding_SampleDuplexHello")
      Try
        Console.ForegroundColor = ConsoleColor.White
        Console.WriteLine("Enter a greeting to send and press ENTER: ")
        Console.Write(">>> ")
        Console.ForegroundColor = ConsoleColor.Green
        Dim greeting As String = Console.ReadLine()
        Console.ForegroundColor = ConsoleColor.White
        Console.WriteLine("Called service with: " & Constants.vbCrLf & Constants.vbTab & greeting)
        wcfClient.Hello(greeting)
        Console.WriteLine("Execution passes service call and moves to the WaitHandle.")
        Me.waitHandle.WaitOne()
        Console.ForegroundColor = ConsoleColor.Blue
        Console.WriteLine("Set was called.")
        Console.Write("Press ")
        Console.ForegroundColor = ConsoleColor.Red
        Console.Write("ENTER")
        Console.ForegroundColor = ConsoleColor.Blue
        Console.Write(" to exit...")
        Console.ReadLine()
      Catch timeProblem As TimeoutException
        Console.WriteLine("The service operation timed out. " & timeProblem.Message)
        Console.ReadLine()
      Catch commProblem As CommunicationException
        Console.WriteLine("There was a communication problem. " & commProblem.Message)
        Console.ReadLine()
      End Try
    End Sub
    Public Shared Sub Main()
      Dim client As New Client()
      client.Run()
    End Sub

    Public Sub Reply(ByVal response As String) Implements SampleDuplexHelloCallback.Reply
      Console.WriteLine("Received output.")
      Console.WriteLine(Constants.vbCrLf & Constants.vbTab & response)
      Me.waitHandle.Set()
    End Sub
  End Class
End Namespace

설명

서비스 계약에 콜백 서비스 instance 필요한 경우 이 생성자를 사용합니다. 형식 매개 변수 및 애플리케이션 구성 파일의 정보로부터 대상 엔드포인트가 생성됩니다.

추가 정보

적용 대상

ClientBase<TChannel>(ServiceEndpoint)

Source:
ClientBase.cs
Source:
ClientBase.cs
Source:
ClientBase.cs

지정된 ClientBase<TChannel>를 사용하여 ServiceEndpoint 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::Description::ServiceEndpoint ^ endpoint);
protected ClientBase (System.ServiceModel.Description.ServiceEndpoint endpoint);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.Description.ServiceEndpoint -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (endpoint As ServiceEndpoint)

매개 변수

endpoint
ServiceEndpoint

클라이언트가 서비스를 찾아서 통신할 수 있게 해주는 서비스 엔드포인트입니다.

적용 대상

ClientBase<TChannel>(InstanceContext, ServiceEndpoint)

지정된 ClientBase<TChannel>InstanceContext 개체를 사용하여 ServiceEndpoint 클래스의 새 인스턴스를 초기화합니다.

protected:
 ClientBase(System::ServiceModel::InstanceContext ^ callbackInstance, System::ServiceModel::Description::ServiceEndpoint ^ endpoint);
protected ClientBase (System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Description.ServiceEndpoint endpoint);
new System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)> : System.ServiceModel.InstanceContext * System.ServiceModel.Description.ServiceEndpoint -> System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>
Protected Sub New (callbackInstance As InstanceContext, endpoint As ServiceEndpoint)

매개 변수

callbackInstance
InstanceContext

클라이언트 애플리케이션이 연결된 서비스로부터 메시지를 수신할 때 사용하는 콜백 개체입니다.

endpoint
ServiceEndpoint

클라이언트가 서비스를 찾아서 통신할 수 있게 해주는 서비스 엔드포인트입니다.

적용 대상