Freigeben über


ActivatedServiceTypeEntry Klasse

Definition

Enthält Werte für einen Objekttyp, der am Dienstende registriert ist, als einen, der auf Anforderung von einem Client 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, bei der es sich um das serverseitige Gegenstück der RemotingConfiguration.RegisterActivatedClientType Methode handelt. Die RegisterActivatedServiceType Methode wird auf dem Server verwendet, um die Remoteaktivierung durch Clients von angegebenen Objekttypen zu ermöglichen.

Um ein clientaktives Objekt auf dem Server zu erstellen, müssen Sie dessen TypeNamen kennen, und es muss mit der RegisterActivatedServiceType Methode auf dem Server registriert werden. Um einen Proxy für ein neues clientaktives Objekt abzurufen, muss der Client zuerst einen Kanal registrieren ChannelServices und dann das Objekt durch Aufrufen new oder Activator.CreateInstanceaktivieren.

Um einen clientaktiven Objekttyp mit dem new Schlüsselwort zu aktivieren, müssen Sie zuerst den Objekttyp auf dem Client mithilfe der RegisterActivatedClientType Methode registrieren. Durch Aufrufen RegisterActivatedClientType geben Sie der Remotinginfrastruktur den Standort der Remoteanwendung an, an dem new versucht wird, sie zu erstellen. Wenn Sie andererseits die CreateInstance Methode verwenden, um eine neue Instanz des clientaktiven Objekts zu erstellen, müssen Sie die URL der Remoteanwendung als Parameter angeben, sodass keine vorherige Registrierung für den 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 einer Instanz der UrlAttribute Klasse kapseln.

Konstruktoren

Name Beschreibung
ActivatedServiceTypeEntry(String, String)

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

ActivatedServiceTypeEntry(Type)

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

Eigenschaften

Name Beschreibung
AssemblyName

Ruft den Assemblynamen des Objekttyps ab, der als Remoteaktivierungstyp konfiguriert ist.

(Geerbt von TypeEntry)
ContextAttributes

Dient zum Abrufen oder Festlegen der Kontextattribute für den clientaktiven Diensttyp.

ObjectType

Ruft den Type clientaktiven Diensttyp ab.

TypeName

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

(Geerbt von TypeEntry)

Methoden

Name Beschreibung
Equals(Object)

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

(Geerbt von Object)
GetHashCode()

Dient als die Standard-Hashfunktion

(Geerbt von Object)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

Gibt den Typ und den Assemblynamen des clientaktiven Diensttyps als ein String.

Gilt für:

Weitere Informationen