Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

RemotingServices.Disconnect Method

Stops an object from receiving any further messages through the registered remoting channels.

Namespace:  System.Runtime.Remoting
Assembly:  mscorlib (in mscorlib.dll)
public static bool Disconnect(
	MarshalByRefObject obj


Type: System.MarshalByRefObject
Object to disconnect from its channel.

Return Value

Type: System.Boolean
true if the object was disconnected from the registered remoting channels successfully; otherwise, false.

The obj parameter is null.


The obj parameter is a proxy.


The immediate caller does not have permission to configure remoting types and channels.

The following code example demonstrates how to use the Disconnect method to disconnect an object from the remoting channels.

TcpChannel channel = new TcpChannel(9000);

SampleWellKnown objectWellKnown = new SampleWellKnown();

// After the channel is registered, the object needs to be registered
// with the remoting infrastructure.  So, Marshal is called.
ObjRef objrefWellKnown = RemotingServices.Marshal(objectWellKnown, "objectWellKnownUri");
Console.WriteLine("An instance of SampleWellKnown type is published at {0}.", objrefWellKnown.URI);

Console.WriteLine("Press enter to unregister SampleWellKnown, so that it is no longer available on this channel.");

Console.WriteLine("Press enter to end the server process.");

.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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.