RemotingConfiguration.RegisterActivatedClientType 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
클라이언트 끝의 개체 Type 를 서버에서 활성화할 수 있는 형식으로 등록합니다.
오버로드
| Name | Description |
|---|---|
| RegisterActivatedClientType(ActivatedClientTypeEntry) |
클라이언트 끝의 제공된 개체에 기록된 ActivatedClientTypeEntry 개체 Type 를 서버에서 활성화할 수 있는 형식으로 등록합니다. |
| RegisterActivatedClientType(Type, String) |
지정된 매개 변수를 사용하여 클라이언트 끝의 개체 Type 를 서버에서 활성화할 수 있는 형식으로 등록하여 클래스의 ActivatedClientTypeEntry 새 인스턴스를 초기화합니다. |
RegisterActivatedClientType(ActivatedClientTypeEntry)
클라이언트 끝의 제공된 개체에 기록된 ActivatedClientTypeEntry 개체 Type 를 서버에서 활성화할 수 있는 형식으로 등록합니다.
public:
static void RegisterActivatedClientType(System::Runtime::Remoting::ActivatedClientTypeEntry ^ entry);
public static void RegisterActivatedClientType(System.Runtime.Remoting.ActivatedClientTypeEntry entry);
static member RegisterActivatedClientType : System.Runtime.Remoting.ActivatedClientTypeEntry -> unit
Public Shared Sub RegisterActivatedClientType (entry As ActivatedClientTypeEntry)
매개 변수
- entry
- ActivatedClientTypeEntry
클라이언트 활성화 형식에 대한 구성 설정입니다.
예외
호출 스택에서 더 높은 호출자 중 하나 이상에는 원격 유형 및 채널을 구성할 수 있는 권한이 없습니다.
설명
서버에서 클라이언트 활성화 개체의 인스턴스를 만들려면 해당 개체를 알고 Type 있어야 하며 이 메서드를 사용하여 RegisterActivatedServiceType 서버 끝에 등록해야 합니다. 클라이언트 활성화 개체의 새 인스턴스에 대한 프록시를 가져오려면 클라이언트가 먼저 채널을 ChannelServices 등록한 다음 호출 new하여 개체를 활성화해야 합니다.
키워드를 사용하여 클라이언트 활성화 개체 형식을 new 활성화하려면 먼저 메서드를 사용하여 RegisterActivatedClientType 클라이언트 쪽에 개체 형식을 등록해야 합니다. 메서드를 RegisterActivatedClientType 호출하면 원격 인프라에 원격 애플리케이션을 만들려는 원격 애플리케이션 new 의 위치가 지정됩니다. 반면에 이 메서드를 사용하여 Activator.CreateInstance 클라이언트 활성화 개체의 새 인스턴스를 만드는 경우 원격 애플리케이션의 URL을 매개 변수로 제공해야 하므로 클라이언트 쪽에 사전 등록이 필요하지 않습니다. 메서드에 Activator.CreateInstance 개체를 만들려는 서버의 URL을 제공하려면 클래스 인스턴스 UrlAttribute 의 URL을 캡슐화해야 합니다.
추가 정보
적용 대상
RegisterActivatedClientType(Type, String)
지정된 매개 변수를 사용하여 클라이언트 끝의 개체 Type 를 서버에서 활성화할 수 있는 형식으로 등록하여 클래스의 ActivatedClientTypeEntry 새 인스턴스를 초기화합니다.
public:
static void RegisterActivatedClientType(Type ^ type, System::String ^ appUrl);
public static void RegisterActivatedClientType(Type type, string appUrl);
static member RegisterActivatedClientType : Type * string -> unit
Public Shared Sub RegisterActivatedClientType (type As Type, appUrl As String)
매개 변수
- appUrl
- String
이 형식이 활성화되는 애플리케이션의 URL입니다.
예외
type 또는 appUrl 매개 변수가 .입니다null.
호출 스택에서 더 높은 호출자 중 하나 이상에는 원격 유형 및 채널을 구성할 수 있는 권한이 없습니다.
예제
다음 코드 예제에서는 서버에서 활성화할 수 있는 형식으로 클라이언트 끝의 개체 형식을 등록하는 방법을 보여 줍니다. 제공된 클라이언트 코드에 해당하는 서버 코드는 메서드의 예제를 RegisterActivatedServiceType 참조하세요.
#using <system.dll>
#using <system.runtime.remoting.dll>
#using "service.dll"
using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
int main()
{
ChannelServices::RegisterChannel( gcnew TcpChannel );
RemotingConfiguration::RegisterActivatedClientType( HelloServiceClass::typeid, "tcp://localhost:8082" );
try
{
HelloServiceClass ^ service = gcnew HelloServiceClass;
// Calls the remote method.
Console::WriteLine();
Console::WriteLine( "Calling remote Object" );
Console::WriteLine( service->HelloMethod( "Caveman" ) );
Console::WriteLine( service->HelloMethod( "Spaceman" ) );
Console::WriteLine( service->HelloMethod( "Client Man" ) );
Console::WriteLine( "Finished remote Object call" );
}
catch (Exception ex)
{
Console::WriteLine("An exception occurred: " + ex.Message);
}
Console::WriteLine();
return 0;
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
public class ClientClass {
public static void Main() {
ChannelServices.RegisterChannel(new TcpChannel());
RemotingConfiguration.RegisterActivatedClientType(typeof(HelloServiceClass),
"tcp://localhost:8082");
try
{
HelloServiceClass service = new HelloServiceClass();
// Calls the remote method.
Console.WriteLine();
Console.WriteLine("Calling remote object");
Console.WriteLine(service.HelloMethod("Caveman"));
Console.WriteLine(service.HelloMethod("Spaceman"));
Console.WriteLine(service.HelloMethod("Client Man"));
Console.WriteLine("Finished remote object call");
Console.WriteLine();
}
catch (Exception ex)
{
Console.WriteLine("An exception occurred: " + ex.Message);
}
}
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Public Class ClientClass
Public Shared Sub Main()
ChannelServices.RegisterChannel(New TcpChannel())
RemotingConfiguration.RegisterActivatedClientType(GetType(HelloServiceClass), "tcp://localhost:8082")
Try
Dim service As New HelloServiceClass()
' Calls the remote method.
Console.WriteLine()
Console.WriteLine("Calling remote object")
Console.WriteLine(service.HelloMethod("Caveman"))
Console.WriteLine(service.HelloMethod("Spaceman"))
Console.WriteLine(service.HelloMethod("Client Man"))
Console.WriteLine("Finished remote object call")
Catch ex as Exception
Console.WriteLine("An exception occurred: " + ex.Message)
End Try
Console.WriteLine()
End Sub
End Class
설명
서버에서 클라이언트 활성화 개체의 인스턴스를 만들려면 해당 개체를 알고 Type 있어야 하며 이 메서드를 사용하여 RegisterActivatedServiceType 서버 끝에 등록해야 합니다. 클라이언트 활성화 개체의 새 인스턴스에 대한 프록시를 가져오려면 클라이언트가 먼저 채널을 ChannelServices 등록한 다음 호출 new하여 개체를 활성화해야 합니다.
키워드를 사용하여 클라이언트 활성화 개체 형식을 new 활성화하려면 먼저 메서드를 사용하여 RegisterActivatedClientType 클라이언트 쪽에 개체 형식을 등록해야 합니다. 메서드를 RegisterActivatedClientType 호출하면 원격 인프라에 원격 애플리케이션을 만들려는 원격 애플리케이션 new 의 위치가 지정됩니다. 반면에 이 메서드를 사용하여 Activator.CreateInstance 클라이언트 활성화 개체의 새 인스턴스를 만드는 경우 원격 애플리케이션의 URL을 매개 변수로 제공해야 하므로 클라이언트 쪽에 사전 등록이 필요하지 않습니다. 메서드에 Activator.CreateInstance 개체를 만들려는 서버의 URL을 제공하려면 클래스 인스턴스 UrlAttribute 의 URL을 캡슐화해야 합니다.