ActivatedClientTypeEntry 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
클라이언트 끝에 등록된 개체 형식에 대한 값을 서버에서 활성화할 수 있는 형식으로 보유합니다.
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 하는 방법을 보여 있습니다. 이 예제에는 클라이언트, 서버 및 클라이언트와 서버에서 사용하는 원격 개체의 세 부분이 포함되어 있습니다.
다음 코드 예제에서는 클라이언트를 보여줍니다.
#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을 제공하려면 클래스 인스턴스 UrlAttribute 의 URL을 캡슐화해야 합니다.
생성자
| Name | Description |
|---|---|
| ActivatedClientTypeEntry(String, String, String) |
지정된 형식 이름, 어셈블리 이름 및 애플리케이션 URL을 사용하여 클래스의 ActivatedClientTypeEntry 새 인스턴스를 초기화합니다. |
| ActivatedClientTypeEntry(Type, String) |
지정된 Type 및 애플리케이션 URL을 ActivatedClientTypeEntry 사용하여 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| ApplicationUrl |
형식을 활성화할 애플리케이션의 URL을 가져옵니다. |
| AssemblyName |
원격 활성화 형식으로 구성된 개체 형식의 어셈블리 이름을 가져옵니다. (다음에서 상속됨 TypeEntry) |
| ContextAttributes |
클라이언트 활성화 형식의 컨텍스트 특성을 가져오거나 설정합니다. |
| ObjectType |
클라이언트 활성화 Type 형식의 형식을 가져옵니다. |
| TypeName |
원격 활성화 형식으로 구성된 개체 형식의 전체 형식 이름을 가져옵니다. (다음에서 상속됨 TypeEntry) |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정한 개체와 현재 개체가 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 작동합니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
클라이언트 활성화 형식의 형식 이름, 어셈블리 이름 및 애플리케이션 URL을 로 String반환합니다. |