Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

RemotingServices.Marshal Method (MarshalByRefObject, String, Type)

Takes a MarshalByRefObject and converts it into an instance of the ObjRef class with the specified URI, and the provided Type.

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

public static ObjRef Marshal (
	MarshalByRefObject Obj,
	string ObjURI,
	Type RequestedType
)
public static ObjRef Marshal (
	MarshalByRefObject Obj, 
	String ObjURI, 
	Type RequestedType
)
public static function Marshal (
	Obj : MarshalByRefObject, 
	ObjURI : String, 
	RequestedType : Type
) : ObjRef
Not applicable.

Parameters

Obj

The object to convert into a ObjRef.

ObjURI

The URI the object specified in the Obj parameter is marshaled with. Can be a null reference (Nothing in Visual Basic).

RequestedType

The TypeObj is marshaled as. Can be a null reference (Nothing in Visual Basic).

Return Value

An instance of the ObjRef class that represents the object specified in the Obj parameter.

Exception typeCondition

RemotingException

Obj is a proxy of a remote object, and the ObjUri parameter is not a null reference (Nothing in Visual Basic).

SecurityException

At least one of the callers higher in the callstack does not have permission to configure remoting types and channels.

A ObjRef is a serializable representation of an object used to transfer an object reference across an application domain boundary. Creating a ObjRef for an object is known as marshaling. The ObjRef can be transferred through a channel into another application domain (possibly on another process or computer). Once in the other application domain, the ObjRef must be parsed to create a proxy for the object, generally connected to the real object. This operation is known as unmarshaling.

A ObjRef contains information that describes the Type and class of the object being marshaled, a URI that uniquely identifies the specific object instance, and communication related information about how to reach the remoting subdivision where the object is located.

The specified Type is used by the remoting infrastructure to limit the scope of the exposed type hierarchy. For example, if object A derives from object B, which derives from object C, and Marshal is called, then the client can cast the proxy between C and B but not to A.

During marshaling, the context from the current thread is used, not the context that was active when the object was created.

You cannot associate a URI with a proxy for one of two reasons: either the URI was generated at the server side for the object it represents, or the object is well known, in which case the URI is known. For this reason, if the Obj parameter is a proxy, an exception will be thrown. For custom proxies this restriction is relaxed because the transparent proxy is treated as the server object.

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft