WellKnownServiceTypeEntry Klasa

Definicja

Przechowuje wartości typu obiektu zarejestrowanego na końcu usługi jako obiekt typu aktywowanego przez serwer (pojedyncze wywołanie lub pojedynczy).

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
Dziedziczenie
WellKnownServiceTypeEntry
Atrybuty

Przykłady

#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

Uwagi

Typy obiektów aktywowanych przez serwer mogą być pojedynczym wywołaniem lub pojedynczymi. Jeśli typ obiektu jest pojedynczym wywołaniem, nowe wystąpienie jest tworzone przy każdym wywołaniu klienta. Wszystkie wywołania pojedynczego obiektu są obsługiwane przez jedno wystąpienie tego obiektu.

Każdy klient, który zna identyfikator URI tego obiektu, może uzyskać serwer proxy dla tego obiektu, rejestrując preferowany kanał ChannelServices i uaktywniając obiekt przez wywołanie lub newActivator.GetObject.

Należy pamiętać, że sam obiekt zdalny nie jest tworzony przez proces rejestracji. Dzieje się tak tylko wtedy, gdy klient próbuje wywołać metodę na obiekcie lub aktywuje obiekt po stronie klienta.

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

Konstruktory

WellKnownServiceTypeEntry(String, String, String, WellKnownObjectMode)

Inicjuje WellKnownServiceTypeEntry nowe wystąpienie klasy o podanej nazwie typu, nazwie zestawu, identyfikatorze URI obiektu i WellKnownObjectMode.

WellKnownServiceTypeEntry(Type, String, WellKnownObjectMode)

Inicjuje WellKnownServiceTypeEntry nowe wystąpienie klasy przy użyciu podanego Typeidentyfikatora URI obiektu i WellKnownObjectMode.

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 serwer.

Mode

WellKnownObjectMode Pobiera typ usługi aktywowanej przez serwer.

ObjectType

Type Pobiera typ usługi aktywowanej przez serwer.

ObjectUri

Pobiera identyfikator URI dobrze znanego typu usługi.

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 bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

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

(Odziedziczone po Object)
ToString()

Zwraca nazwę typu, nazwę zestawu, identyfikator URI obiektu i WellKnownObjectMode typ aktywowany przez serwer jako String.

Dotyczy

Zobacz też