WellKnownClientTypeEntry クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
サーバーアクティブ化型 (単一呼び出しまたはシングルトン) としてクライアントに登録されているオブジェクト型の値を保持します。
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
- 継承
- 属性
例
#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 に希望するチャネルを登録し、 new または Activator.GetObjectを呼び出してオブジェクトをアクティブ化することで、このオブジェクトのプロキシを取得できます。
newを使用してサーバーアクティブ化オブジェクトをアクティブ化するには、まず、RegisterWellKnownClientType メソッドを使用して、サーバーアクティブ化オブジェクトの種類をクライアントに登録する必要があります。
RegisterWellKnownClientTypeを呼び出すことで、リモート処理インフラストラクチャにリモート オブジェクトの場所を指定します。これにより、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として返します。 |