WellKnownServiceTypeEntry Class
Assembly: mscorlib (in mscorlib.dll)
'Declaration <ComVisibleAttribute(True)> _ Public Class WellKnownServiceTypeEntry Inherits TypeEntry 'Usage Dim instance As WellKnownServiceTypeEntry
/** @attribute ComVisibleAttribute(true) */ public class WellKnownServiceTypeEntry extends TypeEntry
ComVisibleAttribute(true) public class WellKnownServiceTypeEntry extends TypeEntry
Server-activated object types can be either single call or singleton. If an object type is single call, a new instance of it is created each time a call from the client comes in. All calls to a singleton object are handled by one instance of that object.
Any client that knows the URI of this object can obtain a proxy for this object by registering the channel it prefers with ChannelServices and activating the object by calling new or Activator.GetObject.
It is important to note that the remote object itself is not created by the registration process. This only happens when a client attempts to call a method on the object or activates the object from the client side.
For a more detailed description of server-activated objects and remote object activation, see Activation of Remote Objects.
Imports System 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 'Main End Class 'MyServer
import System.*;
import System.Runtime.Remoting.*;
import System.Runtime.Remoting.Channels.*;
import System.Runtime.Remoting.Channels.Http.*;
public class MyServer
{
public static void main(String[] args)
{
// 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(HelloServer.class.ToType(),
"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].get_Mode());
Console.WriteLine("The 'WellKnownServiceTypeEntry' object: "
+ myWellKnownServiceTypeEntryCollection.get_Item(0).ToString());
Console.WriteLine("Started the Server, Hit <enter> to exit...");
Console.ReadLine();
} //main
} //MyServer
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.