RemotingConfiguration.RegisterActivatedServiceType 메서드

정의

개체 Type을 클라이언트의 요청에 따라 활성화될 수 있는 형식으로 서비스 쪽에 등록합니다.

오버로드

RegisterActivatedServiceType(ActivatedServiceTypeEntry)

제공된 ActivatedServiceTypeEntry에 기록된 개체 형식을 클라이언트의 요청에 따라 활성화될 수 있는 형식으로 서비스 쪽에 등록합니다.

RegisterActivatedServiceType(Type)

지정된 개체 형식을 클라이언트의 요청에 따라 활성화될 수 있는 형식으로 서비스 쪽에 등록합니다.

RegisterActivatedServiceType(ActivatedServiceTypeEntry)

제공된 ActivatedServiceTypeEntry에 기록된 개체 형식을 클라이언트의 요청에 따라 활성화될 수 있는 형식으로 서비스 쪽에 등록합니다.

public:
 static void RegisterActivatedServiceType(System::Runtime::Remoting::ActivatedServiceTypeEntry ^ entry);
public static void RegisterActivatedServiceType (System.Runtime.Remoting.ActivatedServiceTypeEntry entry);
static member RegisterActivatedServiceType : System.Runtime.Remoting.ActivatedServiceTypeEntry -> unit
Public Shared Sub RegisterActivatedServiceType (entry As ActivatedServiceTypeEntry)

매개 변수

entry
ActivatedServiceTypeEntry

클라이언트 활성 형식에 대한 구성 설정입니다.

예외

호출 스택의 상위 호출자 중 하나 이상에게 원격 형식 및 채널을 구성하기 위한 권한이 없는 경우

설명

서버에서 클라이언트 활성화 개체의 instance 만들려면 해당 개체를 알고 Type 있어야 하며 메서드를 사용하여 RegisterActivatedServiceType 서버 끝에 등록해야 합니다. 클라이언트 활성화 개체의 새 instance 대한 프록시를 가져오려면 먼저 에 채널을 ChannelServices 등록한 다음 또는 Activator.CreateInstance을 호출 new 하여 개체를 활성화해야 합니다.

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

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

추가 정보

적용 대상

RegisterActivatedServiceType(Type)

지정된 개체 형식을 클라이언트의 요청에 따라 활성화될 수 있는 형식으로 서비스 쪽에 등록합니다.

public:
 static void RegisterActivatedServiceType(Type ^ type);
public static void RegisterActivatedServiceType (Type type);
static member RegisterActivatedServiceType : Type -> unit
Public Shared Sub RegisterActivatedServiceType (type As Type)

매개 변수

type
Type

등록할 개체의 Type입니다.

예외

호출 스택의 상위 호출자 중 하나 이상에게 원격 형식 및 채널을 구성하기 위한 권한이 없는 경우

예제

다음 코드 예제에서는 서버에서 개체 형식을 클라이언트에서 활성화할 수 있는 형식으로 등록하는 방법을 보여 줍니다. 제공된 서버 코드에 해당하는 클라이언트 코드는 메서드의 예제를 RegisterActivatedClientType 참조하세요.

#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( 8082 ) );
   RemotingConfiguration::RegisterActivatedServiceType( HelloServiceClass::typeid );
   Console::WriteLine( "Press enter to stop this process." );
   Console::ReadLine();
   return 0;
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class ServerClass {

    public static void Main()  {

        ChannelServices.RegisterChannel(new TcpChannel(8082));

        RemotingConfiguration.RegisterActivatedServiceType(typeof(HelloServiceClass));

        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 ServerClass
      
   Public Shared Sub Main()
      
      ChannelServices.RegisterChannel(New TcpChannel(8082))     
      RemotingConfiguration.RegisterActivatedServiceType(GetType(HelloServiceClass))
      
      Console.WriteLine("Press enter to stop this process.")
      Console.ReadLine()

   End Sub

End Class

다음 코드 예제에서는 위의 샘플 코드에 등록된 서비스 개체를 보여줍니다.

#using <system.dll>

using namespace System;

public ref class HelloServiceClass: public MarshalByRefObject
{
private:
   static int n_instance;

public:
   HelloServiceClass()
   {
      n_instance++;
      Console::WriteLine(  "{0} has been created.  Instance # = {1}", this->GetType()->Name, n_instance );
   }

   ~HelloServiceClass()
   {
      Console::WriteLine( "Destroyed instance {0} of HelloServiceClass.", n_instance );
      n_instance--;
   }

   String^ HelloMethod( String^ name )
   {
      // Reports that the method was called.
      Console::WriteLine();
      Console::WriteLine( "Called HelloMethod on instance {0} with the '{1}' parameter.", n_instance, name );

      // Calculates and returns the result to the client.
      return String::Format( "Hi there {0}", name );
   }
};
using System;

public class HelloServiceClass : MarshalByRefObject {

    static int n_instance;

    public HelloServiceClass() {
        n_instance++;
        Console.WriteLine(this.GetType().Name + " has been created.  Instance # = {0}", n_instance);
    }

    ~HelloServiceClass() {
        Console.WriteLine("Destroyed instance {0} of HelloServiceClass.", n_instance);
        n_instance --;
    }

    public String HelloMethod(String name) {

        // Reports that the method was called.
        Console.WriteLine();
        Console.WriteLine("Called HelloMethod on instance {0} with the '{1}' parameter.",
                             n_instance, name);

        // Calculates and returns the result to the client.
        return "Hi there " + name + ".";
    }
}
Public Class HelloServiceClass
   Inherits MarshalByRefObject
   
   Private Shared n_instance As Integer

      
   Public Sub New()
      n_instance += 1
      Console.WriteLine(Me.GetType().Name + " has been created.  Instance # = {0}", n_instance)
   End Sub
      
   
   Protected Overrides Sub Finalize()
      Console.WriteLine("Destroyed instance {0} of HelloServiceClass.", n_instance)
      n_instance -= 1
      MyBase.Finalize()
   End Sub
   
   
   
   Public Function HelloMethod(name As [String]) As [String]
      
      ' Reports that the method was called.
      Console.WriteLine()
      Console.WriteLine("Called HelloMethod on instance {0} with the '{1}' parameter.", n_instance, name)
      
      ' Calculates and returns the result to the client.
      Return "Hi there " + name + "."

   End Function 'HelloMethod

End Class

설명

서버에서 클라이언트 활성화 개체의 instance 만들려면 해당 개체를 알고 Type 있어야 하며 메서드를 사용하여 RegisterActivatedServiceType 서버 끝에 등록해야 합니다. 클라이언트 활성화 개체의 새 instance 대한 프록시를 가져오려면 먼저 에 채널을 ChannelServices 등록한 다음 또는 Activator.CreateInstance을 호출 new 하여 개체를 활성화해야 합니다.

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

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

추가 정보

적용 대상