다음을 통해 공유


ActivatedServiceTypeEntry 클래스

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

네임스페이스: System.Runtime.Remoting
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<ComVisibleAttribute(True)> _
Public Class ActivatedServiceTypeEntry
    Inherits TypeEntry
‘사용 방법
Dim instance As ActivatedServiceTypeEntry
[ComVisibleAttribute(true)] 
public class ActivatedServiceTypeEntry : TypeEntry
[ComVisibleAttribute(true)] 
public ref class ActivatedServiceTypeEntry : public TypeEntry
/** @attribute ComVisibleAttribute(true) */ 
public class ActivatedServiceTypeEntry extends TypeEntry
ComVisibleAttribute(true) 
public class ActivatedServiceTypeEntry extends TypeEntry

설명

현재 클래스는 RemotingConfiguration.RegisterActivatedClientType 메서드의 서버측 메서드인 RemotingConfiguration.RegisterActivatedServiceType 메서드에서 사용됩니다. RegisterActivatedServiceType 메서드는 지정된 개체 형식의 클라이언트에서 원격으로 활성화할 수 있도록 서버에서 사용됩니다.

클라이언트 활성 개체의 인스턴스를 서버에 만들려면 해당 Type을 알아야 하고 RegisterActivatedServiceType 메서드를 사용하여 이 인스턴스를 서버 쪽에 등록해야 합니다. 클라이언트 활성 개체에 대한 프록시를 얻으려면 먼저 클라이언트에서 ChannelServices에 채널을 등록한 다음 new 또는 Activator.CreateInstance를 호출하여 개체를 활성화해야 합니다.

클라이언트 활성 개체 형식을 new 키워드를 사용하여 활성화하려면 먼저 RegisterActivatedClientType 메서드를 사용하여 개체 형식을 클라이언트에 등록해야 합니다. RegisterActivatedClientType을 호출하면 new로 개체를 만들려는 원격 응용 프로그램의 위치를 원격 인프라에 알려 줄 수 있습니다. 반면에 CreateInstance 메서드를 사용하여 클라이언트 활성 개체의 새 인스턴스를 만들 경우에는 원격 응용 프로그램의 URL을 매개 변수로 제공해야 하므로 클라이언트에 미리 등록할 필요가 없습니다. 개체를 만들려는 서버의 URL을 가진 CreateInstance 메서드를 제공하려면 UrlAttribute 클래스의 인스턴스에서 URL을 캡슐화해야 합니다.

클라이언트 활성 개체 및 원격 개체 활성화에 대한 자세한 내용은 원격 개체의 활성화를 참조하십시오.

예제

Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp

Public Class MyClient
   
   Public Shared Sub Main()
      ChannelServices.RegisterChannel(New TcpChannel(8082))
      ' Create an instance of 'ActivatedServiceTypeEntry' class
      ' which holds the values for 'HelloServer' type.
      Dim myActivatedServiceTypeEntry As New ActivatedServiceTypeEntry(GetType(HelloServer))
      ' Register an object Type on the service end so that 
      ' it can be activated on request from a client.
      RemotingConfiguration.RegisterActivatedServiceType(myActivatedServiceTypeEntry)
      ' Get the registered activated service types .
      Dim myActivatedServiceEntries As ActivatedServiceTypeEntry() = RemotingConfiguration. _
                                                         GetRegisteredActivatedServiceTypes()
      Console.WriteLine("Information of first registered activated " + " service type :")
      Console.WriteLine("Object type: " + myActivatedServiceEntries(0).ObjectType.ToString())
      Console.WriteLine("Description: " + myActivatedServiceEntries(0).ToString())
      Console.WriteLine("Press enter to stop this process")
      Console.ReadLine()
   End Sub 'Main
End Class 'MyClient
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MyClient
{
   public static void Main()
   {
      ChannelServices.RegisterChannel(new TcpChannel(8082));
      // Create an instance of 'ActivatedServiceTypeEntry' class
      // which holds the values for 'HelloServer' type.
      ActivatedServiceTypeEntry myActivatedServiceTypeEntry =
                   new ActivatedServiceTypeEntry(typeof(HelloServer));
      // Register an object Type on the service end so that 
      // it can be activated on request from a client.
      RemotingConfiguration.RegisterActivatedServiceType(
                                         myActivatedServiceTypeEntry);
      // Get the registered activated service types .
      ActivatedServiceTypeEntry[] myActivatedServiceEntries =
          RemotingConfiguration.GetRegisteredActivatedServiceTypes();
      Console.WriteLine("Information of first registered activated "
                             +" service type :");
      Console.WriteLine("Object type: "
                       +myActivatedServiceEntries[0].ObjectType);
      Console.WriteLine("Description: " 
                           +myActivatedServiceEntries[0].ToString());
      Console.WriteLine("Press enter to stop this process");
      Console.ReadLine();
   }
}
#using <System.Runtime.Remoting.dll>
#using <ActivatedServiceTypeEntry_ObjectType_Share.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 ) );
   
   // Create an instance of 'ActivatedServiceTypeEntry' class
   // which holds the values for 'HelloServer' type.
   ActivatedServiceTypeEntry^ myActivatedServiceTypeEntry =
      gcnew ActivatedServiceTypeEntry( HelloServer::typeid );
   
   // Register an object Type on the service end so that 
   // it can be activated on request from a client.
   RemotingConfiguration::RegisterActivatedServiceType(
      myActivatedServiceTypeEntry );
   
   // Get the registered activated service types.
   array<ActivatedServiceTypeEntry^>^ activatedServiceEntries =
      RemotingConfiguration::GetRegisteredActivatedServiceTypes();
   Console::WriteLine( "Information of first registered activated" +
     " service type :" );
   Console::WriteLine( "Object type: {0}",
      activatedServiceEntries[ 0 ]->ObjectType->ToString() );
   Console::WriteLine( "Description: {0}",
      activatedServiceEntries[ 0 ]->ToString() );

   Console::WriteLine( "Press enter to stop this process" );
   Console::ReadLine();
}
import System.*;
import System.Runtime.Remoting.*;
import System.Runtime.Remoting.Channels.*;
import System.Runtime.Remoting.Channels.Tcp.*;

public class MyClient
{
    public static void main(String[] args)
    {
        ChannelServices.RegisterChannel(new TcpChannel(8082));

        // Create an instance of 'ActivatedServiceTypeEntry' class
        // which holds the values for 'HelloServer' type.
        ActivatedServiceTypeEntry myActivatedServiceTypeEntry = 
            new ActivatedServiceTypeEntry(HelloServer.class.ToType());

        // Register an object Type on the service end so that 
        // it can be activated on request from a client.
        RemotingConfiguration.RegisterActivatedServiceType(
            myActivatedServiceTypeEntry);

        // Get the registered activated service types.
        ActivatedServiceTypeEntry myActivatedServiceEntries[] = 
            RemotingConfiguration.GetRegisteredActivatedServiceTypes();

        Console.WriteLine("Information of first registered activated " 
            + " service type :");
        Console.WriteLine("Object type: " 
            + ((ActivatedServiceTypeEntry)myActivatedServiceEntries.
            get_Item(0)).get_ObjectType());
        Console.WriteLine("Description: " 
            + myActivatedServiceEntries.get_Item(0).ToString());

        Console.WriteLine("Press enter to stop this process");
        Console.ReadLine();
    } //main
} //MyClient

상속 계층 구조

System.Object
   System.Runtime.Remoting.TypeEntry
    System.Runtime.Remoting.ActivatedServiceTypeEntry

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

ActivatedServiceTypeEntry 멤버
System.Runtime.Remoting 네임스페이스
RegisterActivatedServiceType

기타 리소스

클라이언트 활성화