ActivatedServiceTypeEntry Klasa

Definicja

Przechowuje wartości typu obiektu zarejestrowanego na końcu usługi jako taki, który można aktywować na żądanie od klienta.

public ref class ActivatedServiceTypeEntry : System::Runtime::Remoting::TypeEntry
public class ActivatedServiceTypeEntry : System.Runtime.Remoting.TypeEntry
[System.Runtime.InteropServices.ComVisible(true)]
public class ActivatedServiceTypeEntry : System.Runtime.Remoting.TypeEntry
type ActivatedServiceTypeEntry = class
    inherit TypeEntry
[<System.Runtime.InteropServices.ComVisible(true)>]
type ActivatedServiceTypeEntry = class
    inherit TypeEntry
Public Class ActivatedServiceTypeEntry
Inherits TypeEntry
Dziedziczenie
ActivatedServiceTypeEntry
Atrybuty

Przykłady

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

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
void main()
{
   ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) );
   
   // Create an instance of 'ActivatedServiceTypeEntry' class
   // which holds the values for 'HelloServer' type.
   ActivatedServiceTypeEntry^ myActivatedServiceTypeEntry =
      gcnew ActivatedServiceTypeEntry( HelloServer::typeid );
   
   // Register an object Type on the service end so that 
   // it can be activated on request from a client.
   RemotingConfiguration::RegisterActivatedServiceType(
      myActivatedServiceTypeEntry );
   
   // Get the registered activated service types.
   array<ActivatedServiceTypeEntry^>^ activatedServiceEntries =
      RemotingConfiguration::GetRegisteredActivatedServiceTypes();
   Console::WriteLine( "Information of first registered activated" +
     " service type :" );
   Console::WriteLine( "Object type: {0}",
      activatedServiceEntries[ 0 ]->ObjectType->ToString() );
   Console::WriteLine( "Description: {0}",
      activatedServiceEntries[ 0 ]->ToString() );

   Console::WriteLine( "Press enter to stop this process" );
   Console::ReadLine();
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MyClient
{
   public static void Main()
   {
      ChannelServices.RegisterChannel(new TcpChannel(8082));
      // Create an instance of 'ActivatedServiceTypeEntry' class
      // which holds the values for 'HelloServer' type.
      ActivatedServiceTypeEntry myActivatedServiceTypeEntry =
                   new ActivatedServiceTypeEntry(typeof(HelloServer));
      // Register an object Type on the service end so that
      // it can be activated on request from a client.
      RemotingConfiguration.RegisterActivatedServiceType(
                                         myActivatedServiceTypeEntry);
      // Get the registered activated service types .
      ActivatedServiceTypeEntry[] myActivatedServiceEntries =
          RemotingConfiguration.GetRegisteredActivatedServiceTypes();
      Console.WriteLine("Information of first registered activated "
                             +" service type :");
      Console.WriteLine("Object type: "
                       +myActivatedServiceEntries[0].ObjectType);
      Console.WriteLine("Description: "
                           +myActivatedServiceEntries[0].ToString());
      Console.WriteLine("Press enter to stop this process");
      Console.ReadLine();
   }
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp

Public Class MyClient
   
   Public Shared Sub Main()
      ChannelServices.RegisterChannel(New TcpChannel(8082))
      ' Create an instance of 'ActivatedServiceTypeEntry' class
      ' which holds the values for 'HelloServer' type.
      Dim myActivatedServiceTypeEntry As New ActivatedServiceTypeEntry(GetType(HelloServer))
      ' Register an object Type on the service end so that 
      ' it can be activated on request from a client.
      RemotingConfiguration.RegisterActivatedServiceType(myActivatedServiceTypeEntry)
      ' Get the registered activated service types .
      Dim myActivatedServiceEntries As ActivatedServiceTypeEntry() = RemotingConfiguration. _
                                                         GetRegisteredActivatedServiceTypes()
      Console.WriteLine("Information of first registered activated " + " service type :")
      Console.WriteLine("Object type: " + myActivatedServiceEntries(0).ObjectType.ToString())
      Console.WriteLine("Description: " + myActivatedServiceEntries(0).ToString())
      Console.WriteLine("Press enter to stop this process")
      Console.ReadLine()
   End Sub
End Class

Uwagi

Bieżąca klasa jest używana przez metodę RemotingConfiguration.RegisterActivatedServiceType , która jest odpowiednikiem RemotingConfiguration.RegisterActivatedClientType metody po stronie serwera. Metoda RegisterActivatedServiceType jest używana na serwerze, aby umożliwić zdalną aktywację przez klientów określonych typów obiektów.

Aby utworzyć obiekt aktywowany przez klienta na serwerze, musisz znać jego Typeelement i musi zostać zarejestrowany na końcu serwera przy użyciu RegisterActivatedServiceType metody . Aby uzyskać serwer proxy dla nowego obiektu aktywowanego przez klienta, klient musi najpierw zarejestrować kanał za pomocą ChannelServices polecenia , a następnie aktywować obiekt przez wywołanie metody new lub Activator.CreateInstance.

Aby aktywować typ obiektu aktywowanego przez klienta za new pomocą słowa kluczowego , należy najpierw zarejestrować typ obiektu na kliencie przy użyciu RegisterActivatedClientType metody . Wywołując RegisterActivatedClientType polecenie , udostępniasz infrastrukturę komunikacji zdalnej lokalizację aplikacji zdalnej, w której new próbuje ją utworzyć. Jeśli z drugiej strony używasz CreateInstance metody do utworzenia nowego wystąpienia obiektu aktywowanego przez klienta, musisz podać adres URL aplikacji zdalnej jako parametr, więc nie jest wymagana wcześniejsza rejestracja na kliencie. Aby podać metodę CreateInstance przy użyciu adresu URL serwera, na którym chcesz utworzyć obiekt, należy hermetyzować adres URL w wystąpieniu UrlAttribute klasy.

Aby uzyskać szczegółowy opis obiektów aktywowanych przez klienta i aktywacji obiektów zdalnych, zobacz Aktywacja obiektów zdalnych.

Konstruktory

ActivatedServiceTypeEntry(String, String)

Inicjuje ActivatedServiceTypeEntry nowe wystąpienie klasy o podanej nazwie typu i nazwie zestawu.

ActivatedServiceTypeEntry(Type)

Inicjuje ActivatedServiceTypeEntry nowe wystąpienie klasy przy użyciu danej Typeklasy .

Właściwości

AssemblyName

Pobiera nazwę zestawu typu obiektu skonfigurowanego jako typ aktywowany zdalnie.

(Odziedziczone po TypeEntry)
ContextAttributes

Pobiera lub ustawia atrybuty kontekstu dla typu usługi aktywowanej przez klienta.

ObjectType

Type Pobiera typ usługi aktywowanej przez klienta.

TypeName

Pobiera pełną nazwę typu obiektu skonfigurowanego jako typ aktywowany zdalnie.

(Odziedziczone po TypeEntry)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca typ i nazwę zestawu typu usługi aktywowanej przez klienta jako String.

Dotyczy

Zobacz też