WellKnownClientTypeEntry クラス

定義

サーバー側でアクティブ化される型 (単一の呼び出しまたはシングルトン) としてクライアントに登録されたオブジェクト型の値を保持します。

public ref class WellKnownClientTypeEntry : System::Runtime::Remoting::TypeEntry
public class WellKnownClientTypeEntry : System.Runtime.Remoting.TypeEntry
[System.Runtime.InteropServices.ComVisible(true)]
public class WellKnownClientTypeEntry : System.Runtime.Remoting.TypeEntry
type WellKnownClientTypeEntry = class
    inherit TypeEntry
[<System.Runtime.InteropServices.ComVisible(true)>]
type WellKnownClientTypeEntry = class
    inherit TypeEntry
Public Class WellKnownClientTypeEntry
Inherits TypeEntry
継承
WellKnownClientTypeEntry
属性

#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <WellKnownClientTypeEntry_Share.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Http;

int main()
{
   // Create a 'HttpChannel' object and  register with channel services.
   ChannelServices::RegisterChannel( gcnew HttpChannel );
   Console::WriteLine( " Start calling from Client One......." );
   WellKnownClientTypeEntry^ myWellKnownClientTypeEntry = gcnew WellKnownClientTypeEntry( HelloServer::typeid,"http://localhost:8086/SayHello" );
   myWellKnownClientTypeEntry->ApplicationUrl = "http://localhost:8086/SayHello";
   RemotingConfiguration::RegisterWellKnownClientType( myWellKnownClientTypeEntry );

   // Get the proxy object for the remote object.
   HelloServer^ myHelloServerObject = gcnew HelloServer;

   // Retrieve an array of object types registered on the 
   // client end as well-known types.
   array<WellKnownClientTypeEntry^>^myWellKnownClientTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownClientTypes();
   Console::WriteLine( "The Application Url to activate the Remote Object :{0}", myWellKnownClientTypeEntryCollection[ 0 ]->ApplicationUrl );
   Console::WriteLine( "The 'WellKnownClientTypeEntry' object :{0}", myWellKnownClientTypeEntryCollection[ 0 ] );

   // Make remote method calls.
   for ( int i = 0; i < 5; i++ )
      Console::WriteLine( myHelloServerObject->HelloMethod( " Client One" ) );
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

public class MyClient 
{
   public static void Main()
   {
   // Create a 'HttpChannel' object and  register with channel services.
   ChannelServices.RegisterChannel(new HttpChannel());
   Console.WriteLine(" Start calling from Client One.......");
   WellKnownClientTypeEntry myWellKnownClientTypeEntry = 
                  new WellKnownClientTypeEntry(typeof(HelloServer),
                                  "http://localhost:8086/SayHello");
   myWellKnownClientTypeEntry.ApplicationUrl="http://localhost:8086/SayHello";
   RemotingConfiguration.RegisterWellKnownClientType(myWellKnownClientTypeEntry);
   // Get the proxy object for the remote object.
   HelloServer myHelloServerObject = new HelloServer();
   // Retrieve an array of object types registered on the 
   // client end as well-known types.
   WellKnownClientTypeEntry [] myWellKnownClientTypeEntryCollection = 
          RemotingConfiguration.GetRegisteredWellKnownClientTypes();
   Console.WriteLine("The Application Url to activate the Remote Object :"
        +myWellKnownClientTypeEntryCollection[0].ApplicationUrl);
   Console.WriteLine("The 'WellKnownClientTypeEntry' object :"
            +myWellKnownClientTypeEntryCollection[0].ToString());
   // Make remote method calls.
   for (int i = 0; i < 5; i++)
         Console.WriteLine(myHelloServerObject.HelloMethod(" Client One"));
   }
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Http

Public Class MyClient
   
   Public Shared Sub Main()
      ' Create a 'HttpChannel' object and  register with channel services.
      ChannelServices.RegisterChannel(New HttpChannel())
      Console.WriteLine(" Start calling from Client One.......")
      Dim myWellKnownClientTypeEntry As New WellKnownClientTypeEntry(GetType(HelloServer), _ 
                                                  "http://localhost:8086/SayHello")
      myWellKnownClientTypeEntry.ApplicationUrl = "http://localhost:8086/SayHello"
      RemotingConfiguration.RegisterWellKnownClientType(myWellKnownClientTypeEntry)
      ' Get the proxy object for the remote object.
      Dim myHelloServerObject As New HelloServer()
      ' Retrieve an array of object types registered on the 
      ' client end as well-known types.
      Dim myWellKnownClientTypeEntryCollection As WellKnownClientTypeEntry() = _ 
                                       RemotingConfiguration.GetRegisteredWellKnownClientTypes()
      Console.WriteLine("The Application Url to activate the Remote Object :" + _ 
                                           myWellKnownClientTypeEntryCollection(0).ApplicationUrl)
      Console.WriteLine("The 'WellKnownClientTypeEntry' object :" + _ 
                                              myWellKnownClientTypeEntryCollection(0).ToString())
      ' Make remote method calls.
      Dim i As Integer
      For i = 0 To 4
         Console.WriteLine(myHelloServerObject.HelloMethod(" Client One"))
      Next i
   End Sub
End Class

注釈

サーバーでアクティブ化される型は、単一呼び出しまたはシングルトンのいずれかです。 クラスが 1 つの呼び出しの種類として登録されている場合、クライアントからの呼び出しが到着するたびに新しいインスタンスが作成されます。 シングルトン オブジェクトに対するすべての呼び出しは、そのオブジェクトが収集されていない限り、そのオブジェクトの 1 つのインスタンスによって処理されます。

登録済みのサーバーでアクティブ化されたオブジェクトの URI を認識しているクライアントは、目的のチャネルChannelServicesを登録し、 または Activator.GetObjectを呼び出newしてオブジェクトをアクティブ化することで、このオブジェクトのプロキシを取得できます。 を使用してサーバーでアクティブ化されたオブジェクト newをアクティブ化するには、 メソッドを使用して、最初にサーバーでアクティブ化されたオブジェクトの種類をクライアントに登録する RegisterWellKnownClientType 必要があります。 を呼び出RegisterWellKnownClientTypeすことで、リモート処理インフラストラクチャにリモート オブジェクトの場所を指定します。これにより、キーワード (keyword)でリモート オブジェクトを作成できますnew。 一方、 メソッドを使用 Activator.GetObject してサーバーでアクティブ化されたオブジェクトをアクティブ化する場合は、オブジェクトの URL を引数として指定する必要があるため、クライアントでの事前登録は必要ありません。

サーバーでアクティブ化されたオブジェクトとリモート オブジェクトのアクティブ化の詳細については、「 リモート オブジェクトのアクティブ化」を参照してください。

コンストラクター

WellKnownClientTypeEntry(String, String, String)

指定した型、アセンブリ名、および URL を使用して、WellKnownClientTypeEntry クラスの新しいインスタンスを初期化します。

WellKnownClientTypeEntry(Type, String)

指定した型と URL を使用して、WellKnownClientTypeEntry クラスの新しいインスタンスを初期化します。

プロパティ

ApplicationUrl

型をアクティブにするアプリケーションの URL を取得または設定します。

AssemblyName

リモート アクティブ型になるように構成されたオブジェクト型のアセンブリ名を取得します。

(継承元 TypeEntry)
ObjectType

サーバー側でアクティブ化されるクライアント型の Type を取得します。

ObjectUrl

サーバー側でアクティブ化されるクライアント オブジェクトの URL を取得します。

TypeName

リモート アクティブ型になるように構成されたオブジェクト型の完全な型名を取得します。

(継承元 TypeEntry)

メソッド

Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

サーバー側でアクティブ化されるクライアント型の完全な型名、アセンブリ名、オブジェクトの URL を String として返します。

適用対象

こちらもご覧ください