WellKnownServiceTypeEntry Třída

Definice

Obsahuje hodnoty pro typ objektu zaregistrovaný na konci služby jako objekt typu aktivovaný serverem (jedno volání nebo singleton).

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
Dědičnost
WellKnownServiceTypeEntry
Atributy

Příklady

#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

Poznámky

Typy objektů aktivovaných serverem můžou být buď jedno volání, nebo singleton. Pokud je typ objektu jedno volání, vytvoří se při každém volání z klienta jeho nová instance. Všechna volání jednoúčelového objektu jsou zpracována jednou instancí tohoto objektu.

Každý klient, který zná identifikátor URI tohoto objektu, může získat proxy pro tento objekt registrací kanálu, který ChannelServices preferuje, a aktivací objektu voláním new nebo Activator.GetObject.

Je důležité si uvědomit, že samotný vzdálený objekt není vytvořen procesem registrace. K tomu dochází pouze v případě, že se klient pokusí volat metodu objektu nebo aktivuje objekt ze strany klienta.

Podrobnější popis objektů aktivovaných serverem a vzdálené aktivace objektů najdete v tématu Aktivace vzdálených objektů.

Konstruktory

WellKnownServiceTypeEntry(String, String, String, WellKnownObjectMode)

Inicializuje novou instanci WellKnownServiceTypeEntry třídy s názvem daného typu, názvem sestavení, identifikátorem URI objektu a WellKnownObjectMode.

WellKnownServiceTypeEntry(Type, String, WellKnownObjectMode)

Inicializuje novou instanci WellKnownServiceTypeEntry třídy s daným Typeidentifikátorem , identifikátor URI objektu a WellKnownObjectMode.

Vlastnosti

AssemblyName

Získá název sestavení typu objektu nakonfigurovaný jako typ vzdálené aktivace.

(Zděděno od TypeEntry)
ContextAttributes

Získá nebo nastaví atributy kontextu pro typ služby aktivované serverem.

Mode

WellKnownObjectMode Získá typ služby aktivované serverem.

ObjectType

Type Získá typ služby aktivované serverem.

ObjectUri

Získá identifikátor URI dobře známého typu služby.

TypeName

Získá úplný název typu objektu typ nakonfigurovaný být vzdáleně aktivovaný typ.

(Zděděno od TypeEntry)

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Získá aktuální Type instanci.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
ToString()

Vrátí název typu, název sestavení, identifikátor URI objektu WellKnownObjectMode a typ aktivovaný serverem Stringjako .

Platí pro

Viz také