WellKnownServiceTypeEntry Klasa
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Przechowuje wartości typu obiektu zarejestrowanego na końcu usługi jako obiekt typu aktywowanego przez serwer (pojedyncze wywołanie lub pojedyncze).
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
- 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 za każdym razem, gdy pojawi się wywołanie 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 ChannelServices kanał i uaktywniając obiekt przez wywołanie new metody lub Activator.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ę w obiekcie lub aktywuje obiekt po stronie klienta.
Konstruktory
| Nazwa | Opis |
|---|---|
| WellKnownServiceTypeEntry(String, String, String, WellKnownObjectMode) |
Inicjuje nowe wystąpienie WellKnownServiceTypeEntry klasy o podanej nazwie typu, nazwie zestawu, identyfikatorze URI obiektu i WellKnownObjectMode. |
| WellKnownServiceTypeEntry(Type, String, WellKnownObjectMode) |
Inicjuje nowe wystąpienie WellKnownServiceTypeEntry klasy przy użyciu podanego Typeidentyfikatora URI obiektu i WellKnownObjectMode. |
Właściwości
| Nazwa | Opis |
|---|---|
| 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 znanego typu usługi. |
| TypeName |
Pobiera pełną nazwę typu obiektu skonfigurowanego jako typ aktywowany zdalnie. (Odziedziczone po TypeEntry) |
Metody
| Nazwa | Opis |
|---|---|
| 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() |
Pobiera Type bieżącego wystąpienia. (Odziedziczone po Object) |
| MemberwiseClone() |
Tworzy płytkią kopię bieżącego Object. (Odziedziczone po Object) |
| ToString() |
Zwraca nazwę typu, nazwę zestawu, identyfikator URI obiektu i WellKnownObjectMode typ aktywowany przez serwer jako String. |