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 を認識するすべてのクライアントは、 ChannelServices に優先するチャネルを登録し、 new または Activator.GetObjectを呼び出してオブジェクトをアクティブ化することで、このオブジェクトのプロキシを取得できます。

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

コンストラクター

名前 説明
WellKnownServiceTypeEntry(String, String, String, WellKnownObjectMode)

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

WellKnownServiceTypeEntry(Type, String, WellKnownObjectMode)

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

プロパティ

名前 説明
AssemblyName

リモートアクティブ化された型として構成されたオブジェクト型のアセンブリ名を取得します。

(継承元 TypeEntry)
ContextAttributes

サーバーによってアクティブ化されるサービスの種類のコンテキスト属性を取得または設定します。

Mode

サーバーでアクティブ化されたサービスの種類の WellKnownObjectMode を取得します。

ObjectType

サーバーでアクティブ化されたサービスの種類の Type を取得します。

ObjectUri

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

TypeName

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

(継承元 TypeEntry)

メソッド

名前 説明
Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

Stringとして、型名、アセンブリ名、オブジェクト URI、およびサーバーアクティブ化型のWellKnownObjectModeを返します。

適用対象

こちらもご覧ください