Export (0) Print
Expand All

ActivatedServiceTypeEntry Class

Holds values for an object type registered on the service end as one that can be activated on request from a client.

Namespace: System.Runtime.Remoting
Assembly: mscorlib (in mscorlib.dll)

[ComVisibleAttribute(true)] 
public class ActivatedServiceTypeEntry : TypeEntry
/** @attribute ComVisibleAttribute(true) */ 
public class ActivatedServiceTypeEntry extends TypeEntry
ComVisibleAttribute(true) 
public class ActivatedServiceTypeEntry extends TypeEntry

The current class is used by the RemotingConfiguration.RegisterActivatedServiceType method, which is the server-side counterpart of the RemotingConfiguration.RegisterActivatedClientType method. The RegisterActivatedServiceType method is used on the server to allow remote activation by clients of specified object types.

To create a client-activated object on the server, you must know its Type, and it must be registered on the server end by using the RegisterActivatedServiceType method. To obtain a proxy for a new client-activated object, the client must first register a channel with ChannelServices and then activate the object by calling new or Activator.CreateInstance.

To activate a client-activated object type with the new keyword, you must first register the object type on the client using the RegisterActivatedClientType method. By calling RegisterActivatedClientType you are giving the remoting infrastructure the location of the remote application where new attempts to create it. If, on the other hand, you use the CreateInstance method to create a new instance of the client-activated object, you must supply the remote application's URL as a parameter, so no prior registration on the client is necessary. To supply the CreateInstance method with the URL of the server on which you want to create the object, you must encapsulate the URL in an instance of the UrlAttribute class.

For a detailed description of client-activated objects and remote object activation, see Activation of Remote Objects.

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();
   }
}

import System.*;
import System.Runtime.Remoting.*;
import System.Runtime.Remoting.Channels.*;
import System.Runtime.Remoting.Channels.Tcp.*;

public class MyClient
{
    public static void main(String[] args)
    {
        ChannelServices.RegisterChannel(new TcpChannel(8082));

        // Create an instance of 'ActivatedServiceTypeEntry' class
        // which holds the values for 'HelloServer' type.
        ActivatedServiceTypeEntry myActivatedServiceTypeEntry = 
            new ActivatedServiceTypeEntry(HelloServer.class.ToType());

        // 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: " 
            + ((ActivatedServiceTypeEntry)myActivatedServiceEntries.
            get_Item(0)).get_ObjectType());
        Console.WriteLine("Description: " 
            + myActivatedServiceEntries.get_Item(0).ToString());

        Console.WriteLine("Press enter to stop this process");
        Console.ReadLine();
    } //main
} //MyClient

System.Object
   System.Runtime.Remoting.TypeEntry
    System.Runtime.Remoting.ActivatedServiceTypeEntry

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft