ActivatedClientTypeEntry 클래스

정의

서버에서 활성화할 수 있는 형식으로 클라이언트 쪽에 등록된 개체 형식에 대한 값이 들어 있습니다.

public ref class ActivatedClientTypeEntry : System::Runtime::Remoting::TypeEntry
public class ActivatedClientTypeEntry : System.Runtime.Remoting.TypeEntry
[System.Runtime.InteropServices.ComVisible(true)]
public class ActivatedClientTypeEntry : System.Runtime.Remoting.TypeEntry
type ActivatedClientTypeEntry = class
    inherit TypeEntry
[<System.Runtime.InteropServices.ComVisible(true)>]
type ActivatedClientTypeEntry = class
    inherit TypeEntry
Public Class ActivatedClientTypeEntry
Inherits TypeEntry
상속
ActivatedClientTypeEntry
특성

예제

다음 코드 예제를 사용 하는 방법을 보여 줍니다는 ActivatedClientTypeEntry 클라이언트를 등록 하려면 원격 개체를 활성화 합니다. 이 예제에서는 세 부분으로 구성, 클라이언트, 서버 및 클라이언트와 서버에서 사용 하는 원격 개체를 포함 합니다.

다음 코드 예제에서는 클라이언트를 보여 줍니다.

#using <System.Runtime.Remoting.dll>
#using <ActivatedClientTypeEntry_Share.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
static void main()
{
   // Register TCP Channel.
   ChannelServices::RegisterChannel( gcnew TcpChannel );
   
   // Create activated client type entry.
   ActivatedClientTypeEntry^ activatedClientTypeEntry = gcnew ActivatedClientTypeEntry( HelloServer::typeid, "tcp://localhost:8082" );
   
   // Register type on client to activate it on the server.
   RemotingConfiguration::RegisterActivatedClientType( activatedClientTypeEntry );
   
   // Activate a client activated object type.
   HelloServer^ helloServer = gcnew HelloServer( "ParameterString" );
   
   // Print the object type.
   Console::WriteLine( "Object type of client activated object: {0}", activatedClientTypeEntry->ObjectType->ToString() );
   
   // Print the application URL.
   Console::WriteLine( "Application url where the type is activated: {0}", activatedClientTypeEntry->ApplicationUrl->ToString() );
   
   // Print the string representation of the type entry.
   Console::WriteLine( "Type and assembly name and application URL of the remote object: {0}", activatedClientTypeEntry->ToString() );
   
   // Print a blank line.
   Console::WriteLine();
   
   // Check that server was located.
   if (  !helloServer )
   {
      Console::WriteLine( "Could not locate server" );
   }
   else
   {
      Console::WriteLine( "Calling remote object" );
      Console::WriteLine( helloServer->HelloMethod( "Bill" ) );
   }
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MyClient
{
    public static void Main()
    {
        // Register TCP Channel.
        ChannelServices.RegisterChannel(new TcpChannel());

        // Create activated client type entry.
        ActivatedClientTypeEntry myActivatedClientTypeEntry =
            new ActivatedClientTypeEntry(typeof(HelloServer),
            "tcp://localhost:8082");

        // Register type on client to activate it on the server.
        RemotingConfiguration.RegisterActivatedClientType(
            myActivatedClientTypeEntry);

        // Activate a client activated object type.
        HelloServer myHelloServer = new HelloServer("ParameterString");

        // Print the object type.
        Console.WriteLine(
            "Object type of client activated object: " +
            myActivatedClientTypeEntry.ObjectType.ToString());

        // Print the application URL.
        Console.WriteLine(
            "Application url where the type is activated: " +
            myActivatedClientTypeEntry.ApplicationUrl);

        // Print the string representation of the type entry.
        Console.WriteLine(
            "Type name, assembly name and application URL " +
            "of the remote object: " +
            myActivatedClientTypeEntry.ToString());

        // Print a blank line.
        Console.WriteLine();

        // Check that server was located.
        if (myHelloServer == null)
        {
            Console.WriteLine("Could not locate server");
        }
        else
        {
            Console.WriteLine("Calling remote object");
            Console.WriteLine(myHelloServer.HelloMethod("Bill"));
        }
    }
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp

Public Class MyClient
    
    Public Shared Sub Main()
        ' Register TCP Channel.
        ChannelServices.RegisterChannel(New TcpChannel())

        ' Create activated client type entry.
        Dim myActivatedClientTypeEntry As _
            New ActivatedClientTypeEntry(GetType(HelloServer), _
            "tcp://localhost:8082")

        ' Register type on client to activate it on the server.
        RemotingConfiguration.RegisterActivatedClientType( _
            myActivatedClientTypeEntry)

        ' Activate a client activated object type.
        Dim myHelloServer As New HelloServer("ParameterString")

        ' Print the object type.
        Console.WriteLine("Object type of client activated object: " + _
            myActivatedClientTypeEntry.ObjectType.ToString())

        ' Print the application URL.
        Console.WriteLine("Application url where the type is activated: " + _
            myActivatedClientTypeEntry.ApplicationUrl)

        ' Print the string representation of the type entry.
        Console.WriteLine( _
            "Type name, assembly name and application URL " + _
            "of the remote object: " + _
            myActivatedClientTypeEntry.ToString())

        ' Print a blank line.
        Console.WriteLine()

        ' Check that server was located.
        If myHelloServer Is Nothing Then
            Console.WriteLine("Could not locate server")
        Else
            Console.WriteLine("Calling remote object")
            Console.WriteLine(myHelloServer.HelloMethod("Bill"))
        End If
    End Sub
End Class

다음 코드 예제에서는이 클라이언트에 대 한 서버를 보여 줍니다.

#using <ActivatedClientTypeEntry_Share.dll>
#using <System.Runtime.Remoting.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
void main()
{
   ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) );
   RemotingConfiguration::RegisterActivatedServiceType( HelloServer::typeid );
   Console::WriteLine( "Press enter to stop this process" );
   Console::ReadLine();
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MyServer
{
    public static void Main()
    {
        ChannelServices.RegisterChannel(new TcpChannel(8082));
        RemotingConfiguration.RegisterActivatedServiceType(typeof(HelloServer));
        Console.WriteLine("Press enter to stop this process");
        Console.ReadLine();
   }
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp

Public Class MyServer
    
    Public Shared Sub Main()
        ChannelServices.RegisterChannel(New TcpChannel(8082))
        RemotingConfiguration.RegisterActivatedServiceType(GetType(HelloServer))
        Console.WriteLine("Press enter to stop this process")
        Console.ReadLine()
    End Sub

End Class

다음 코드 예제는 클라이언트와 서버에서 사용 되는 원격 개체를 제공 합니다.

using namespace System;
public ref class HelloServer: public MarshalByRefObject
{
public:
   HelloServer( String^ myString )
   {
      Console::WriteLine( "HelloServer activated" );
      Console::WriteLine( "Paramater passed to the constructor is {0}", myString );
   }

   String^ HelloMethod( String^ myName )
   {
      Console::WriteLine( "HelloMethod : {0}", myName );
      return String::Format( "Hi there {0}", myName );
   }

};
using System;
public class HelloServer : MarshalByRefObject
{
    public HelloServer(String myString)
    {
        Console.WriteLine("HelloServer activated");
        Console.WriteLine("Parameter passed to the constructor is "+myString);
    }
    public String HelloMethod(String myName)
    {
        Console.WriteLine("HelloMethod : {0}",myName);
        return "Hi there " + myName;
    }
}
Public Class HelloServer
    Inherits MarshalByRefObject
    
    Public Sub New(myString As String)
        Console.WriteLine("HelloServer activated")
        Console.WriteLine("Parameter passed to the constructor is " + myString)
    End Sub
    
    Public Function HelloMethod(myName As String) As String
        Console.WriteLine("HelloMethod : {0}", myName)
        Return "Hi there " + myName
    End Function 'HelloMethod
End Class

설명

클라이언트에서 클라이언트가 활성화 한 개체의 인스턴스를 만들려고 알아야 해당 Type 를 사용 하 여 클라이언트에 등록 해야 하 고는 RegisterActivatedClientType 메서드. 프록시 클라이언트를 먼저 등록 해야 합니다는 클라이언트가 활성화 한 개체의 새 인스턴스를 사용 하 여 채널을 가져오려고 ChannelServices 한 다음 호출 하 여 개체를 활성화 new합니다.

클라이언트 활성 개체 형식을 활성화 하는 new 키워드를 먼저 등록 해야 개체 형식을 사용 하는 클라이언트에는 RegisterActivatedClientType 메서드. 호출 하 여 RegisterActivatedClientType 부여할 원격 인프라 원격 애플리케이션의 위치는 new 를 만듭니다. 반면에 사용 하는 경우는 Activator.CreateInstance 클라이언트가 활성화 한 개체의 새 인스턴스를 만드는 메서드를 하므로 클라이언트 쪽에 없는 이전 등록이 필요한 원격 애플리케이션의 URL을 매개 변수로 제공 해야 합니다. 제공 하는 Activator.CreateInstance 서버의 URL 사용 하 여 메서드 하려는 개체를 만들고에서 인스턴스의 URL을 캡슐화 해야 합니다는 UrlAttribute 클래스입니다.

클라이언트 활성화 개체 및 원격 개체 활성화에 대한 자세한 설명은 원격 개체 활성화를 참조하세요.

생성자

ActivatedClientTypeEntry(String, String, String)

주어진 형식 이름, 어셈블리 이름 및 애플리케이션 URL을 사용하여 ActivatedClientTypeEntry 클래스의 새 인스턴스를 초기화합니다.

ActivatedClientTypeEntry(Type, String)

주어진 ActivatedClientTypeEntry 및 애플리케이션 URL을 사용하여 Type 클래스의 새 인스턴스를 초기화합니다.

속성

ApplicationUrl

형식을 활성화할 애플리케이션의 URL을 가져옵니다.

AssemblyName

원격 활성 형식으로 구성된 개체 형식의 어셈블리 이름을 가져옵니다.

(다음에서 상속됨 TypeEntry)
ContextAttributes

클라이언트 활성 형식에 대한 컨텍스트 특성을 가져오거나 설정합니다.

ObjectType

클라이언트 활성 형식의 Type을 가져옵니다.

TypeName

원격 활성 형식으로 구성된 개체 형식의 전체 형식 이름을 가져옵니다.

(다음에서 상속됨 TypeEntry)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

클라이언트 활성 형식의 형식 이름, 어셈블리 이름 및 애플리케이션 URL을 String으로 반환합니다.

적용 대상

추가 정보