WellKnownClientTypeEntry クラス
アセンブリ: mscorlib (mscorlib.dll 内)


サーバー側でアクティブ化される型には、単一の呼び出しまたはシングルトンがあります。クラスが単一呼び出し型として登録されている場合は、クライアントからの呼び出しが到達するたびに、新しいインスタンスが作成されます。シングルトン オブジェクトのすべての呼び出しは、オブジェクトが収集されていない限り、そのオブジェクトの 1 つのインスタンスによって処理されます。
登録されたサーバー側でアクティブ化されるオブジェクトの URI を知っているすべてのクライアントは、ChannelServices で優先するチャネルを登録し、new または Activator.GetObject を呼び出してそのオブジェクトをアクティブにすることにより、このオブジェクトに対するプロキシを取得できます。new でサーバー側でアクティブ化されるオブジェクトをアクティブにするには、初めに RegisterWellKnownClientType メソッドを使用して、そのサーバー側でアクティブ化されるオブジェクトの型をクライアント側で登録しておく必要があります。RegisterWellKnownClientType を呼び出すと、new キーワードに作成を許可するリモート オブジェクトの場所がリモート処理インフラストラクチャに通知されます。一方、Activator.GetObject メソッドを使用して、サーバー側でアクティブ化されるオブジェクトをアクティブにする場合は、そのオブジェクトの URL を引数として指定する必要があります。このため、クライアント側での事前の登録は必要ありません。
サーバー側でアクティブ化されるオブジェクトとリモート オブジェクト アクティベーションの詳細については、「リモート オブジェクトのアクティべーション」を参照してください。

Imports System 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 'Main End Class 'MyClient
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")); } }
#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" ) ); }
import System.*; import System.Runtime.Remoting.*; import System.Runtime.Remoting.Channels.*; import System.Runtime.Remoting.Channels.Http.*; public class MyClient { public static void main(String[] args) { // Create a 'HttpChannel' object and register with channel services. ChannelServices.RegisterChannel(new HttpChannel()); Console.WriteLine(" Start calling from Client One......."); WellKnownClientTypeEntry myWellKnownClientTypeEntry = new WellKnownClientTypeEntry(HelloServer.class.ToType() , "http://localhost:8086/SayHello"); myWellKnownClientTypeEntry. set_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].get_ApplicationUrl()); Console.WriteLine("The 'WellKnownClientTypeEntry' object :" + myWellKnownClientTypeEntryCollection.get_Item(0).ToString()); // Make remote method calls. for (int i = 0; i < 5; i++) { Console.WriteLine(myHelloServerObject.HelloMethod(" Client One")); } } //main } //MyClient

System.Runtime.Remoting.TypeEntry
System.Runtime.Remoting.WellKnownClientTypeEntry


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- WellKnownClientTypeEntry クラスのページへのリンク