ActivatedServiceTypeEntry Klasse

Definition

Enthält Werte für einen Objekttyp, der auf der Dienstseite als solcher registriert ist und auf Anforderung eines Clients aktiviert werden kann.

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
Vererbung
ActivatedServiceTypeEntry
Attribute

Beispiele

#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

Hinweise

Die aktuelle Klasse wird von der RemotingConfiguration.RegisterActivatedServiceType -Methode verwendet, die die serverseitige Entsprechung der RemotingConfiguration.RegisterActivatedClientType -Methode ist. Die RegisterActivatedServiceType -Methode wird auf dem Server verwendet, um die Remoteaktivierung durch Clients der angegebenen Objekttypen zu ermöglichen.

Um ein vom Client aktiviertes Objekt auf dem Server zu erstellen, müssen Sie dessen Typekennen, und es muss auf dem Serverende mithilfe der RegisterActivatedServiceType -Methode registriert werden. Um einen Proxy für ein neues clientaktiviertes Objekt zu erhalten, muss der Client zuerst einen Kanal bei ChannelServices registrieren und das Objekt dann durch Aufrufen new von oder Activator.CreateInstanceaktivieren.

Um einen vom Client aktivierten Objekttyp mit dem new Schlüsselwort (keyword) zu aktivieren, müssen Sie zuerst den Objekttyp mithilfe der -Methode auf dem RegisterActivatedClientType Client registrieren. Durch den Aufruf RegisterActivatedClientType geben Sie der Remotinginfrastruktur den Speicherort der Remoteanwendung an, an new dem versucht wird, sie zu erstellen. Wenn Sie dagegen die CreateInstance -Methode verwenden, um eine neue instance des vom Client aktivierten Objekts zu erstellen, müssen Sie die URL der Remoteanwendung als Parameter angeben, sodass keine vorherige Registrierung auf dem Client erforderlich ist. Um die CreateInstance -Methode mit der URL des Servers anzugeben, auf dem Sie das Objekt erstellen möchten, müssen Sie die URL in einem instance der UrlAttribute -Klasse kapseln.

Eine ausführliche Beschreibung der vom Client aktivierten Objekte und der Remoteobjektaktivierung finden Sie unter Aktivierung von Remoteobjekten.

Konstruktoren

ActivatedServiceTypeEntry(String, String)

Initialisiert eine neue Instanz der ActivatedServiceTypeEntry-Klasse mit dem angegebenen Typamen und dem angegebenen Assemblynamen.

ActivatedServiceTypeEntry(Type)

Initialisiert eine neue Instanz der ActivatedServiceTypeEntry-Klasse mit dem angegebenen Type.

Eigenschaften

AssemblyName

Ruft den Assemblynamen des Objekttyps ab, der als remote aktivierter Typ konfiguriert ist.

(Geerbt von TypeEntry)
ContextAttributes

Ruft die Kontextattribute für den vom Client aktivierten Diensttyp ab oder legt diese fest.

ObjectType

Ruft den Type des vom Client aktivierten Diensttyps ab.

TypeName

Ruft den vollständigen Typnamen des Objekttyps ab, der als remote aktivierter Typ konfiguriert ist.

(Geerbt von TypeEntry)

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt den Typnamen und den Assemblynamen des vom Client aktivierten Diensttyps als String zurück.

Gilt für:

Weitere Informationen