DuplexClientBase<TChannel> クラス

定義

双方向サービスへのチャネルを作成し、そのチャネルをコールバック オブジェクトに関連付けるために使用されます。

generic <typename TChannel>
 where TChannel : classpublic ref class DuplexClientBase abstract : System::ServiceModel::ClientBase<TChannel>
public abstract class DuplexClientBase<TChannel> : System.ServiceModel.ClientBase<TChannel> where TChannel : class
type DuplexClientBase<'Channel (requires 'Channel : null)> = class
    inherit ClientBase<'Channel (requires 'Channel : null)>
Public MustInherit Class DuplexClientBase(Of TChannel)
Inherits ClientBase(Of TChannel)

型パラメーター

TChannel

作成されるチャネルの種類。

継承
DuplexClientBase<TChannel>

次の例は、双方向 WCF クライアント型の クライアントで を使用して、 SampleDuplexHelloClientコールバック をリッスンするコールバック オブジェクトと共に新しい System.ServiceModel.InstanceContext オブジェクトを渡す方法を示しています。

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

注釈

DuplexClientBase<TChannel> クラスを使用して、コールバック オブジェクトを指定するサービスへのチャネルを作成します。 オブジェクトは DuplexClientBase<TChannel> 、WCF オブジェクトの接続を提供する オブジェクトをラップ System.ServiceModel.DuplexChannelFactory<TChannel> します。 どちらの種類でも、双方向サービスに接続できます。 双方向サービスの詳細については、「双方向サービス」を参照してください。

このクラスから派生するマネージド C++ ユーザーに対する特別な注意 :

  • クリーンアップ コードは、デストラクターではなく (On)(Begin)Close (または OnAbort のどちらか一方または両方) に置いてください。

  • デストラクターは使用しないでください。使用すると、コンパイラが IDisposable を自動生成します。

  • 非参照メンバーを使用しないでください。使用すると、コンパイラが IDisposable を自動生成します。

  • ファイナライザーを使用しないでください。使用する場合は、ビルド警告を抑制し、SuppressFinalize(Object) を呼び出し、ファイナライザー自体を (On)(Begin)Close (または OnAbort のどちらか一方または両方) から呼び出して、自動生成される IDisposable の動作をエミュレートする必要があります。

コンストラクター

DuplexClientBase<TChannel>(InstanceContext)

指定したコールバック オブジェクトを使用して DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(InstanceContext, Binding, EndpointAddress)

指定したコールバック オブジェクト、バインディング、およびサービス エンドポイント アドレスを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(InstanceContext, ServiceEndpoint)

指定したコールバック オブジェクトとサービス エンドポイントを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(InstanceContext, String)

指定したコールバック オブジェクトと構成名を使用して DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(InstanceContext, String, EndpointAddress)

指定したコールバック オブジェクト、構成名、およびサービス エンドポイント アドレスを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(InstanceContext, String, String)

指定したコールバック オブジェクト、構成名、およびサービス エンドポイント アドレスを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(Object)

指定したコールバック オブジェクトを使用して DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(Object, Binding, EndpointAddress)

指定したコールバック オブジェクト、バインディング、およびサービス エンドポイント アドレスを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(Object, ServiceEndpoint)

指定したコールバック オブジェクトとサービス エンドポイントを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(Object, String)

指定したコールバック オブジェクトと構成名を使用して DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(Object, String, EndpointAddress)

指定したコールバック オブジェクト、構成名、およびサービス エンドポイント アドレスを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

DuplexClientBase<TChannel>(Object, String, String)

指定したコールバック オブジェクト、エンドポイント構成名、およびサービス エンドポイント アドレスを使用して、DuplexClientBase<TChannel> クラスの新しいインスタンスを初期化します。

プロパティ

Channel

さまざまな構成のサービス エンドポイントにメッセージを送信するために使用する内部チャネルを取得します。

(継承元 ClientBase<TChannel>)
ChannelFactory

基になる ChannelFactory<TChannel> オブジェクトを取得します。

(継承元 ClientBase<TChannel>)
ClientCredentials

操作を呼び出すために使用されるクライアント資格情報を取得します。

(継承元 ClientBase<TChannel>)
Endpoint

WCF クライアントが接続できるサービスのターゲット エンドポイントを取得します。

(継承元 ClientBase<TChannel>)
InnerChannel

基になる IClientChannel 実装を取得します。

(継承元 ClientBase<TChannel>)
InnerDuplexChannel

二重チャネルの基になる IClientChannel の実装を取得します。

State

ClientBase<TChannel> オブジェクトの現在の状態を取得します。

(継承元 ClientBase<TChannel>)

メソッド

Abort()

ClientBase<TChannel> オブジェクトを、現在の状態から Closed 状態に直ちに遷移させます。

(継承元 ClientBase<TChannel>)
Close()

ClientBase<TChannel> オブジェクトを、現在の状態から Closed 状態に遷移させます。

(継承元 ClientBase<TChannel>)
CloseAsync()

双方向サービスへのチャネルを作成し、そのチャネルをコールバック オブジェクトに関連付けるために使用されます。

(継承元 ClientBase<TChannel>)
CreateChannel()

コンストラクターに渡されたコール バックオブジェクトに関連付けられたサービスへのチャネルを返します。

CreateChannel()

サービスへの新しいチャネルを返します。

(継承元 ClientBase<TChannel>)
DisplayInitializationUI()

使用前にチャネルを初期化するときにユーザー インターフェイスが必要な場合は、ユーザー インターフェイスを表示するように内部チャネルに指示します。

(継承元 ClientBase<TChannel>)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetDefaultValueForInitialization<T>()

C# の既定のキーワードの動作をレプリケートします。

(継承元 ClientBase<TChannel>)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
InvokeAsync(ClientBase<TChannel>.BeginOperationDelegate, Object[], ClientBase<TChannel>.EndOperationDelegate, SendOrPostCallback, Object)

イベント ベースの非同期パターンをサポートします。 このパターンの詳細については、「イベント ベースの非同期パターンの概要」を参照してください。

(継承元 ClientBase<TChannel>)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Open()

ClientBase<TChannel> オブジェクトを、Created 状態から Opened 状態に遷移させます。

(継承元 ClientBase<TChannel>)
OpenAsync()

双方向サービスへのチャネルを作成し、そのチャネルをコールバック オブジェクトに関連付けるために使用されます。

(継承元 ClientBase<TChannel>)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

IAsyncDisposable.DisposeAsync()

双方向サービスへのチャネルを作成し、そのチャネルをコールバック オブジェクトに関連付けるために使用されます。

(継承元 ClientBase<TChannel>)
ICommunicationObject.BeginClose(AsyncCallback, Object)

ClientBase<TChannel> を閉じるための非同期操作を開始します。

(継承元 ClientBase<TChannel>)
ICommunicationObject.BeginClose(TimeSpan, AsyncCallback, Object)

指定したタイムアウトで ClientBase<TChannel> を閉じるための非同期操作を開始します。

(継承元 ClientBase<TChannel>)
ICommunicationObject.BeginOpen(AsyncCallback, Object)

ClientBase<TChannel> オブジェクトを開くための非同期操作を開始します。

(継承元 ClientBase<TChannel>)
ICommunicationObject.BeginOpen(TimeSpan, AsyncCallback, Object)

指定した時間内で ClientBase<TChannel> オブジェクトを開くための非同期操作を開始します。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Close()

通信オブジェクトを、現在の状態から Closed 状態に遷移させます。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Close(TimeSpan)

ClientBase<TChannel> オブジェクトを、現在の状態から Closed 状態に遷移させます。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Closed

ClientBase<TChannel> オブジェクトが現在の状態から Closed 状態に遷移するときに呼び出されるイベント ハンドラーです。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Closing

ClientBase<TChannel> オブジェクトが現在の状態から Closed 状態に遷移するときに呼び出されるイベント ハンドラーです。

(継承元 ClientBase<TChannel>)
ICommunicationObject.EndClose(IAsyncResult)

ClientBase<TChannel> オブジェクトを閉じるための非同期操作を完了します。

(継承元 ClientBase<TChannel>)
ICommunicationObject.EndOpen(IAsyncResult)

ClientBase<TChannel> オブジェクトを開くための非同期操作を完了します。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Faulted

ClientBase<TChannel> オブジェクトに対する操作の実行中にエラーが発生したときに呼び出されるイベント ハンドラーです。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Open()

通信オブジェクトを、Created 状態から Opened 状態に遷移させます。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Open(TimeSpan)

指定した時間内に、ClientBase<TChannel> オブジェクトを、Created 状態から Opened 状態に遷移させます。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Opened

ClientBase<TChannel> オブジェクトが Created 状態から Opened 状態に遷移するときに呼び出されるイベント ハンドラーです。

(継承元 ClientBase<TChannel>)
ICommunicationObject.Opening

ClientBase<TChannel> オブジェクトが Created 状態から Opened 状態に遷移するときに呼び出されるイベント ハンドラーです。

(継承元 ClientBase<TChannel>)
IDisposable.Dispose()

Dispose() メソッドの明示的な実装です。

(継承元 ClientBase<TChannel>)

拡張メソッド

CloseHelperAsync(ICommunicationObject, TimeSpan)

双方向サービスへのチャネルを作成し、そのチャネルをコールバック オブジェクトに関連付けるために使用されます。

OpenHelperAsync(ICommunicationObject, TimeSpan)

双方向サービスへのチャネルを作成し、そのチャネルをコールバック オブジェクトに関連付けるために使用されます。

適用対象