다음을 통해 공유


WellKnownClientTypeEntry 클래스

서버 활성 형식(SingleCall 또는 Singleton)으로 클라이언트에 등록된 개체 형식에 대한 값이 들어 있습니다.

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

구문

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

설명

서버 활성 형식은 SingleCall 또는 Singleton일 수 있습니다. 클래스가 SingleCall 형식으로 등록된 경우에는 클라이언트로부터 호출이 올 때마다 새 인스턴스가 만들어집니다. Singleton 개체에 대한 모든 호출은 개체가 수집된 경우가 아니면 해당 개체의 인스턴스 하나에서 모두 처리합니다.

등록된 서버 활성 개체의 URI를 알고 있는 클라이언트에서는 ChannelServices에 원하는 채널을 등록하고 new 또는 Activator.GetObject를 호출하여 개체를 활성화함으로써 이 개체의 프록시를 얻을 수 있습니다. 서버 활성 개체를 new를 사용하여 활성화하려면 먼저 RegisterWellKnownClientType 메서드를 사용하여 서버 활성 개체 형식을 클라이언트 쪽에 등록해야 합니다. RegisterWellKnownClientType을 호출하면 원격 인프라에 원격 개체의 위치를 알 수 있게 되므로 new 키워드로 해당 개체를 만들 수 있습니다. 반면에 Activator.GetObject 메서드를 사용하여 서버 활성 개체를 활성화할 경우에는 개체의 URL을 인수로 제공해야 하므로 클라이언트 쪽에 미리 등록할 필요가 없습니다.

서버 활성 개체 및 원격 개체 활성화에 대한 자세한 내용은 원격 개체의 활성화를 참조하십시오.

예제

Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Http

Public Class MyClient
   
   Public Shared Sub Main()
      ' Create a 'HttpChannel' object and  register with channel services.
      ChannelServices.RegisterChannel(New HttpChannel())
      Console.WriteLine(" Start calling from Client One.......")
      Dim myWellKnownClientTypeEntry As New WellKnownClientTypeEntry(GetType(HelloServer), _ 
                                                  "https://localhost:8086/SayHello")
      myWellKnownClientTypeEntry.ApplicationUrl = "https://localhost:8086/SayHello"
      RemotingConfiguration.RegisterWellKnownClientType(myWellKnownClientTypeEntry)
      ' Get the proxy object for the remote object.
      Dim myHelloServerObject As New HelloServer()
      ' Retrieve an array of object types registered on the 
      ' client end as well-known types.
      Dim myWellKnownClientTypeEntryCollection As WellKnownClientTypeEntry() = _ 
                                       RemotingConfiguration.GetRegisteredWellKnownClientTypes()
      Console.WriteLine("The Application Url to activate the Remote Object :" + _ 
                                           myWellKnownClientTypeEntryCollection(0).ApplicationUrl)
      Console.WriteLine("The 'WellKnownClientTypeEntry' object :" + _ 
                                              myWellKnownClientTypeEntryCollection(0).ToString())
      ' Make remote method calls.
      Dim i As Integer
      For i = 0 To 4
         Console.WriteLine(myHelloServerObject.HelloMethod(" Client One"))
      Next i
   End Sub 'Main
End Class 'MyClient 
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

public class MyClient 
{
   public static void Main()
   {
   // Create a 'HttpChannel' object and  register with channel services.
   ChannelServices.RegisterChannel(new HttpChannel());
   Console.WriteLine(" Start calling from Client One.......");
   WellKnownClientTypeEntry myWellKnownClientTypeEntry = 
                  new WellKnownClientTypeEntry(typeof(HelloServer),
                                  "https://localhost:8086/SayHello");
   myWellKnownClientTypeEntry.ApplicationUrl="https://localhost:8086/SayHello";
   RemotingConfiguration.RegisterWellKnownClientType(myWellKnownClientTypeEntry);
   // Get the proxy object for the remote object.
   HelloServer myHelloServerObject = new HelloServer();
   // Retrieve an array of object types registered on the 
   // client end as well-known types.
   WellKnownClientTypeEntry [] myWellKnownClientTypeEntryCollection = 
          RemotingConfiguration.GetRegisteredWellKnownClientTypes();
   Console.WriteLine("The Application Url to activate the Remote Object :"
        +myWellKnownClientTypeEntryCollection[0].ApplicationUrl);
   Console.WriteLine("The 'WellKnownClientTypeEntry' object :"
            +myWellKnownClientTypeEntryCollection[0].ToString());
   // Make remote method calls.
   for (int i = 0; i < 5; i++)
         Console.WriteLine(myHelloServerObject.HelloMethod(" Client One"));
   }
}
#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <WellKnownClientTypeEntry_Share.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Http;

int main()
{
   // Create a 'HttpChannel' object and  register with channel services.
   ChannelServices::RegisterChannel( gcnew HttpChannel );
   Console::WriteLine( " Start calling from Client One......." );
   WellKnownClientTypeEntry^ myWellKnownClientTypeEntry = gcnew WellKnownClientTypeEntry( HelloServer::typeid,"https://localhost:8086/SayHello" );
   myWellKnownClientTypeEntry->ApplicationUrl = "https://localhost:8086/SayHello";
   RemotingConfiguration::RegisterWellKnownClientType( myWellKnownClientTypeEntry );

   // Get the proxy object for the remote object.
   HelloServer^ myHelloServerObject = gcnew HelloServer;

   // Retrieve an array of object types registered on the 
   // client end as well-known types.
   array<WellKnownClientTypeEntry^>^myWellKnownClientTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownClientTypes();
   Console::WriteLine( "The Application Url to activate the Remote Object :{0}", myWellKnownClientTypeEntryCollection[ 0 ]->ApplicationUrl );
   Console::WriteLine( "The 'WellKnownClientTypeEntry' object :{0}", myWellKnownClientTypeEntryCollection[ 0 ] );

   // Make remote method calls.
   for ( int i = 0; i < 5; i++ )
      Console::WriteLine( myHelloServerObject->HelloMethod( " Client One" ) );
}
import System.*;
import System.Runtime.Remoting.*;
import System.Runtime.Remoting.Channels.*;
import System.Runtime.Remoting.Channels.Http.*;

public class MyClient
{
    public static void main(String[] args)
    {
        // Create a 'HttpChannel' object and  register with channel services.
        ChannelServices.RegisterChannel(new HttpChannel());
        Console.WriteLine(" Start calling from Client One.......");
        WellKnownClientTypeEntry myWellKnownClientTypeEntry = 
            new WellKnownClientTypeEntry(HelloServer.class.ToType(),
            "https://localhost:8086/SayHello");
        myWellKnownClientTypeEntry.
            set_ApplicationUrl("https://localhost:8086/SayHello");
        RemotingConfiguration.RegisterWellKnownClientType(
            myWellKnownClientTypeEntry);
        // Get the proxy object for the remote object.
        HelloServer myHelloServerObject = new HelloServer();
        // Retrieve an array of object types registered on the 
        // client end as well-known types.
        WellKnownClientTypeEntry myWellKnownClientTypeEntryCollection[] =
            RemotingConfiguration.GetRegisteredWellKnownClientTypes();
        Console.WriteLine("The Application Url to activate the Remote Object :" 
            + myWellKnownClientTypeEntryCollection[0].get_ApplicationUrl());
        Console.WriteLine("The 'WellKnownClientTypeEntry' object :" 
            + myWellKnownClientTypeEntryCollection.get_Item(0).ToString());
        // Make remote method calls.
        for (int i = 0; i < 5; i++) {
            Console.WriteLine(myHelloServerObject.HelloMethod(" Client One"));
        }
    } //main
} //MyClient

상속 계층 구조

System.Object
   System.Runtime.Remoting.TypeEntry
    System.Runtime.Remoting.WellKnownClientTypeEntry

스레드로부터의 안전성

이 형식의 모든 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에서 지원

참고 항목

참조

WellKnownClientTypeEntry 멤버
System.Runtime.Remoting 네임스페이스
RegisterWellKnownClientType

기타 리소스

서버 활성화