WellKnownServiceTypeEntry クラス

定義

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

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

#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <WellKnownServiceTypeEntry_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 it with the 
   // channel services.
   ChannelServices::RegisterChannel( gcnew HttpChannel( 8086 ) );

   // Record the 'HelloServer' type as 'Singleton' well-known type.
   WellKnownServiceTypeEntry^ myWellKnownServiceTypeEntry = gcnew WellKnownServiceTypeEntry( HelloServer::typeid,"SayHello",WellKnownObjectMode::Singleton );

   // Register the remote object as well-known type.
   RemotingConfiguration::RegisterWellKnownServiceType( myWellKnownServiceTypeEntry );

   // Retrieve object types registered on the service end 
   // as well-known types.
   array<WellKnownServiceTypeEntry^>^myWellKnownServiceTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownServiceTypes();
   Console::WriteLine( "The 'WellKnownObjectMode' of the remote object : {0}", myWellKnownServiceTypeEntryCollection[ 0 ]->Mode );
   Console::WriteLine( "The 'WellKnownServiceTypeEntry' object: {0}", myWellKnownServiceTypeEntryCollection[ 0 ] );
   Console::WriteLine( "Started the Server, Hit <enter> to exit..." );
   Console::ReadLine();
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

public class MyServer 
{
   public static void Main() 
   {
      // Create a 'HttpChannel' object and register it with the 
      // channel services.
      ChannelServices.RegisterChannel(new HttpChannel(8086));
      // Record the 'HelloServer' type as 'Singleton' well-known type.
      WellKnownServiceTypeEntry myWellKnownServiceTypeEntry= 
          new WellKnownServiceTypeEntry(typeof(HelloServer),
                                        "SayHello",
                                        WellKnownObjectMode.Singleton);
      // Register the remote object as well-known type.
      RemotingConfiguration.RegisterWellKnownServiceType(
                                          myWellKnownServiceTypeEntry);
      // Retrieve object types registered on the service end 
      // as well-known types.
      WellKnownServiceTypeEntry [] myWellKnownServiceTypeEntryCollection = 
            RemotingConfiguration.GetRegisteredWellKnownServiceTypes();
      Console.WriteLine("The 'WellKnownObjectMode' of the remote object : "
                       +myWellKnownServiceTypeEntryCollection[0].Mode);
      Console.WriteLine("The 'WellKnownServiceTypeEntry' object: "+
                  myWellKnownServiceTypeEntryCollection[0].ToString());
      Console.WriteLine("Started the Server, Hit <enter> to exit...");
      Console.ReadLine();
   }
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Http

Public Class MyServer
   
   Public Shared Sub Main()
      ' Create a 'HttpChannel' object and register it with the 
      ' channel services.
      ChannelServices.RegisterChannel(New HttpChannel(8086))
      ' Record the 'HelloServer' type as 'Singleton' well-known type.
      Dim myWellKnownServiceTypeEntry As New WellKnownServiceTypeEntry(GetType(HelloServer), _ 
                                                 "SayHello", WellKnownObjectMode.Singleton)
      ' Register the remote object as well-known type.
      RemotingConfiguration.RegisterWellKnownServiceType(myWellKnownServiceTypeEntry)
      ' Retrieve object types registered on the service end 
      ' as well-known types.
      Dim myWellKnownServiceTypeEntryCollection As WellKnownServiceTypeEntry() = _ 
                                      RemotingConfiguration.GetRegisteredWellKnownServiceTypes()
      Console.WriteLine("The 'WellKnownObjectMode' of the remote object : " + _
                                        myWellKnownServiceTypeEntryCollection(0).Mode.ToString())
      Console.WriteLine("The 'WellKnownServiceTypeEntry' object: " + _ 
                                             myWellKnownServiceTypeEntryCollection(0).ToString())
      Console.WriteLine("Started the Server, Hit <enter> to exit...")
      Console.ReadLine()
   End Sub
End Class

注釈

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

このオブジェクトの URI を認識するすべてのクライアントは、 または Activator.GetObjectを呼び出newして、目的のチャネルChannelServicesを登録し、オブジェクトをアクティブ化することで、このオブジェクトのプロキシを取得できます。

リモート オブジェクト自体は登録プロセスによって作成されないことに注意してください。 これは、クライアントが オブジェクトのメソッドを呼び出そうとしたとき、またはクライアント側からオブジェクトをアクティブ化した場合にのみ発生します。

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

コンストラクター

WellKnownServiceTypeEntry(String, String, String, WellKnownObjectMode)

指定した型名、アセンブリ名、オブジェクト URI、および WellKnownServiceTypeEntry を使用して、WellKnownObjectMode クラスの新しいインスタンスを初期化します。

WellKnownServiceTypeEntry(Type, String, WellKnownObjectMode)

指定した WellKnownServiceTypeEntry、オブジェクト URI、および Type を使用して、WellKnownObjectMode クラスの新しいインスタンスを初期化します。

プロパティ

AssemblyName

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

(継承元 TypeEntry)
ContextAttributes

サーバー側でアクティブ化されるサービス型のコンテキスト属性を取得または設定します。

Mode

サーバー側でアクティブ化されるサービス型の WellKnownObjectMode を取得します。

ObjectType

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

ObjectUri

既知のサービス型の URI を取得します。

TypeName

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

(継承元 TypeEntry)

メソッド

Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

サーバー側でアクティブ化される型の型名、アセンブリ名、オブジェクト URI、および WellKnownObjectModeString として返します。

適用対象

こちらもご覧ください