RemotingServices.Disconnect(MarshalByRefObject) 메서드

정의

등록된 원격 채널을 통해 개체가 추가 메시지를 수신하지 못하도록 합니다.

public:
 static bool Disconnect(MarshalByRefObject ^ obj);
public static bool Disconnect(MarshalByRefObject obj);
[System.Security.SecurityCritical]
public static bool Disconnect(MarshalByRefObject obj);
static member Disconnect : MarshalByRefObject -> bool
[<System.Security.SecurityCritical>]
static member Disconnect : MarshalByRefObject -> bool
Public Shared Function Disconnect (obj As MarshalByRefObject) As Boolean

매개 변수

obj
MarshalByRefObject

채널에서 연결을 끊을 개체입니다.

반품

등록된 원격 채널에서 개체의 연결이 끊어졌으면

특성

예외

매개 변수는 obj .입니다 null.

obj 매개 변수가 프록시입니다.

즉시 호출자에게 원격 유형 및 채널을 구성할 수 있는 권한이 없습니다.

예제

다음 코드 예제에서는 원격 채널에서 개체 연결을 Disconnect 끊기 위해 메서드를 사용 하는 방법을 보여 줍니다.

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();
TcpChannel channel = new TcpChannel(9000);
ChannelServices.RegisterChannel(channel);

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.ReadLine();
RemotingServices.Disconnect(objectWellKnown);

Console.WriteLine("Press enter to end the server process.");
Console.ReadLine();
Dim channel As New TcpChannel(9000)
ChannelServices.RegisterChannel(channel)

Dim objectWellKnown As New SampleWellKnown()
' After the channel is registered, the object needs to be registered
' with the remoting infrastructure.  So, Marshal is called.
Dim objrefWellKnown As ObjRef = 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()

적용 대상