This documentation is archived and is not being maintained.

RealProxy.InitializeServerObject Method

Initializes a new instance of the object Type of the remote object that the current instance of RealProxy represents with the specified IConstructionCallMessage.

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

public IConstructionReturnMessage InitializeServerObject(
	IConstructionCallMessage ctorMsg


Type: System.Runtime.Remoting.Activation.IConstructionCallMessage
A construction call message that contains the constructor parameters for the new instance of the remote object that is represented by the current RealProxy. Can be null.

Return Value

Type: System.Runtime.Remoting.Activation.IConstructionReturnMessage
The result of the construction request.


The immediate caller does not have UnmanagedCode permission.

If the ctorMsg parameter is null, then the InitializeServerObject method calls the default constructor for the new instance of the remote object that is represented by the current RealProxy.

public override IMessage Invoke(IMessage myMessage)
   Console.WriteLine("MyProxy 'Invoke method' Called...");
   if (myMessage is IMethodCallMessage)
   if (myMessage is IMethodReturnMessage)
   if (myMessage is IConstructionCallMessage)
      // Initialize a new instance of remote object
      IConstructionReturnMessage myIConstructionReturnMessage = 
      ConstructionResponse constructionResponse = new 
         ConstructionResponse(null,(IMethodCallMessage) myMessage);
      return constructionResponse;
   IDictionary myIDictionary = myMessage.Properties;
   IMessage returnMessage;
   myIDictionary["__Uri"] = myUri;

   // Synchronously dispatch messages to server.
   returnMessage = ChannelServices.SyncDispatchMessage(myMessage);
   // Pushing return value and OUT parameters back onto stack.
   IMethodReturnMessage myMethodReturnMessage = (IMethodReturnMessage)returnMessage;
   return returnMessage;

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.