다음을 통해 공유


WellKnownServiceTypeEntry 클래스

서버 활성 형식 개체(SingleCall 또는 Singleton 개체)로 서비스 쪽에 등록된 개체 형식에 대한 값이 들어 있습니다.

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

구문

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

설명

서버 활성 개체 형식은 SingleCall 또는 Singleton일 수 있습니다. 개체 형식이 SingleCall이면 클라이언트에서 호출할 때마다 새 인스턴스가 만들어집니다. 반면에 Singleton 개체에 대한 호출은 모두 하나의 해당 개체 인스턴스에서 처리합니다.

이 개체의 URI를 알고 있는 클라이언트에서는 ChannelServices를 사용하고 new 또는 Activator.GetObject를 호출하여 개체를 활성화함으로써 원하는 채널을 등록하여 이 개체의 프록시를 얻을 수 있습니다.

등록 프로세스에서 원격 개체 자체를 만들지는 않습니다. 원격 개체는 클라이언트가 개체에서 메서드를 호출하거나 클라이언트측에서 개체를 활성화하는 경우에만 만들어집니다.

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

예제

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

Public Class MyServer
   
   Public Shared Sub Main()
      ' Create a 'HttpChannel' object and register it with the 
      ' channel services.
      ChannelServices.RegisterChannel(New HttpChannel(8086))
      ' Record the 'HelloServer' type as 'Singleton' well-known type.
      Dim myWellKnownServiceTypeEntry As New WellKnownServiceTypeEntry(GetType(HelloServer), _ 
                                                 "SayHello", WellKnownObjectMode.Singleton)
      ' Register the remote object as well-known type.
      RemotingConfiguration.RegisterWellKnownServiceType(myWellKnownServiceTypeEntry)
      ' Retrieve object types registered on the service end 
      ' as well-known types.
      Dim myWellKnownServiceTypeEntryCollection As WellKnownServiceTypeEntry() = _ 
                                      RemotingConfiguration.GetRegisteredWellKnownServiceTypes()
      Console.WriteLine("The 'WellKnownObjectMode' of the remote object : " + _
                                        myWellKnownServiceTypeEntryCollection(0).Mode.ToString())
      Console.WriteLine("The 'WellKnownServiceTypeEntry' object: " + _ 
                                             myWellKnownServiceTypeEntryCollection(0).ToString())
      Console.WriteLine("Started the Server, Hit <enter> to exit...")
      Console.ReadLine()
   End Sub 'Main
End Class 'MyServer
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

public class MyServer 
{
   public static void Main() 
   {
      // Create a 'HttpChannel' object and register it with the 
      // channel services.
      ChannelServices.RegisterChannel(new HttpChannel(8086));
      // Record the 'HelloServer' type as 'Singleton' well-known type.
      WellKnownServiceTypeEntry myWellKnownServiceTypeEntry= 
          new WellKnownServiceTypeEntry(typeof(HelloServer),
                                        "SayHello",
                                        WellKnownObjectMode.Singleton);
      // Register the remote object as well-known type.
      RemotingConfiguration.RegisterWellKnownServiceType(
                                          myWellKnownServiceTypeEntry);
      // Retrieve object types registered on the service end 
      // as well-known types.
      WellKnownServiceTypeEntry [] myWellKnownServiceTypeEntryCollection = 
            RemotingConfiguration.GetRegisteredWellKnownServiceTypes();
      Console.WriteLine("The 'WellKnownObjectMode' of the remote object : "
                       +myWellKnownServiceTypeEntryCollection[0].Mode);
      Console.WriteLine("The 'WellKnownServiceTypeEntry' object: "+
                  myWellKnownServiceTypeEntryCollection[0].ToString());
      Console.WriteLine("Started the Server, Hit <enter> to exit...");
      Console.ReadLine();
   }
}
#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <WellKnownServiceTypeEntry_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 it with the 
   // channel services.
   ChannelServices::RegisterChannel( gcnew HttpChannel( 8086 ) );

   // Record the 'HelloServer' type as 'Singleton' well-known type.
   WellKnownServiceTypeEntry^ myWellKnownServiceTypeEntry = gcnew WellKnownServiceTypeEntry( HelloServer::typeid,"SayHello",WellKnownObjectMode::Singleton );

   // Register the remote object as well-known type.
   RemotingConfiguration::RegisterWellKnownServiceType( myWellKnownServiceTypeEntry );

   // Retrieve object types registered on the service end 
   // as well-known types.
   array<WellKnownServiceTypeEntry^>^myWellKnownServiceTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownServiceTypes();
   Console::WriteLine( "The 'WellKnownObjectMode' of the remote object : {0}", myWellKnownServiceTypeEntryCollection[ 0 ]->Mode );
   Console::WriteLine( "The 'WellKnownServiceTypeEntry' object: {0}", myWellKnownServiceTypeEntryCollection[ 0 ] );
   Console::WriteLine( "Started the Server, Hit <enter> to exit..." );
   Console::ReadLine();
}
import System.*;
import System.Runtime.Remoting.*;
import System.Runtime.Remoting.Channels.*;
import System.Runtime.Remoting.Channels.Http.*;

public class MyServer
{
    public static void main(String[] args)
    {
        // Create a 'HttpChannel' object and register it with the 
        // channel services.
        ChannelServices.RegisterChannel(new HttpChannel(8086));
        // Record the 'HelloServer' type as 'Singleton' well-known type.
        WellKnownServiceTypeEntry myWellKnownServiceTypeEntry = 
            new WellKnownServiceTypeEntry(HelloServer.class.ToType(),
            "SayHello", WellKnownObjectMode.Singleton);
        // Register the remote object as well-known type.
        RemotingConfiguration.RegisterWellKnownServiceType(
            myWellKnownServiceTypeEntry);
        // Retrieve object types registered on the service end 
        // as well-known types.
        WellKnownServiceTypeEntry myWellKnownServiceTypeEntryCollection[] =
            RemotingConfiguration.GetRegisteredWellKnownServiceTypes();
        Console.WriteLine("The 'WellKnownObjectMode' of the remote object : " 
            + myWellKnownServiceTypeEntryCollection[0].get_Mode());
        Console.WriteLine("The 'WellKnownServiceTypeEntry' object: " 
            + myWellKnownServiceTypeEntryCollection.get_Item(0).ToString());
        Console.WriteLine("Started the Server, Hit <enter> to exit...");
        Console.ReadLine();
    } //main
} //MyServer

상속 계층 구조

System.Object
   System.Runtime.Remoting.TypeEntry
    System.Runtime.Remoting.WellKnownServiceTypeEntry

스레드로부터의 안전성

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

참고 항목

참조

WellKnownServiceTypeEntry 멤버
System.Runtime.Remoting 네임스페이스
RegisterWellKnownServiceType

기타 리소스

서버 활성화