RemotingServices::Disconnect Method
Stops an object from receiving any further messages through the registered remoting channels.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- obj
- Type: System::MarshalByRefObject
Object to disconnect from its channel.
Return Value
Type: System::Booleantrue if the object was disconnected from the registered remoting channels successfully; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentNullException | The obj parameter is nullptr. |
| ArgumentException | The obj parameter is a proxy. |
| SecurityException | 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 = gcnew TcpChannel( 9000 ); ChannelServices::RegisterChannel( channel ); SampleWellKnown ^ objectWellKnown = gcnew 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::ReadLine(); RemotingServices::Disconnect( objectWellKnown ); Console::WriteLine( "Press enter to end the server process." ); Console::ReadLine();
- SecurityPermission
for configuration of the remoting infrastructure. Demand value: SecurityAction::LinkDemand; Permission value: SecurityPermissionFlag::RemotingConfiguration
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.