WellKnownClientTypeEntry 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
클라이언트에 등록된 개체 형식에 대한 값을 서버 활성화 형식(단일 호출 또는 싱글톤)으로 보유합니다.
public ref class WellKnownClientTypeEntry : System::Runtime::Remoting::TypeEntry
public class WellKnownClientTypeEntry : System.Runtime.Remoting.TypeEntry
[System.Runtime.InteropServices.ComVisible(true)]
public class WellKnownClientTypeEntry : System.Runtime.Remoting.TypeEntry
type WellKnownClientTypeEntry = class
inherit TypeEntry
[<System.Runtime.InteropServices.ComVisible(true)>]
type WellKnownClientTypeEntry = class
inherit TypeEntry
Public Class WellKnownClientTypeEntry
Inherits TypeEntry
- 상속
- 특성
예제
#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,"http://localhost:8086/SayHello" );
myWellKnownClientTypeEntry->ApplicationUrl = "http://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" ) );
}
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),
"http://localhost:8086/SayHello");
myWellKnownClientTypeEntry.ApplicationUrl="http://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"));
}
}
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), _
"http://localhost:8086/SayHello")
myWellKnownClientTypeEntry.ApplicationUrl = "http://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
End Class
설명
서버 활성화 형식은 단일 호출 또는 싱글톤일 수 있습니다. 클래스가 단일 호출 유형으로 등록된 경우 클라이언트에서 호출이 도착할 때마다 새 인스턴스가 만들어집니다. 단일 개체에 대한 모든 호출은 해당 개체가 수집되지 않는 한 해당 개체의 한 인스턴스에서 처리됩니다.
등록된 서버 활성화 개체의 URI를 알고 있는 모든 클라이언트는 선호하는 채널을 등록하고 개체를 호출 new 하거나 Activator.GetObject활성화하여 이 개체에 대한 프록시를 ChannelServices 가져올 수 있습니다. 서버 활성화 개체 new를 활성화하려면 먼저 메서드를 사용하여 RegisterWellKnownClientType 클라이언트에 서버 활성화 개체 형식을 등록해야 합니다. 호출 RegisterWellKnownClientType하여 원격 인프라에 원격 개체의 위치를 제공하여 키워드가 new 해당 개체를 만들 수 있도록 합니다. 반면에 이 메서드를 사용하여 Activator.GetObject 서버 활성화 개체를 활성화하는 경우 개체의 URL을 인수로 제공해야 하므로 클라이언트에 대한 사전 등록이 필요하지 않습니다.
생성자
| Name | Description |
|---|---|
| WellKnownClientTypeEntry(String, String, String) |
지정된 형식, 어셈블리 이름 및 URL을 WellKnownClientTypeEntry 사용하여 클래스의 새 인스턴스를 초기화합니다. |
| WellKnownClientTypeEntry(Type, String) |
지정된 형식 및 URL을 WellKnownClientTypeEntry 사용하여 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| ApplicationUrl |
형식을 활성화할 애플리케이션의 URL을 가져오거나 설정합니다. |
| AssemblyName |
원격 활성화 형식으로 구성된 개체 형식의 어셈블리 이름을 가져옵니다. (다음에서 상속됨 TypeEntry) |
| ObjectType |
서버 활성화 Type 클라이언트 유형의 값을 가져옵니다. |
| ObjectUrl |
서버 활성화 클라이언트 개체의 URL을 가져옵니다. |
| TypeName |
원격 활성화 형식으로 구성된 개체 형식의 전체 형식 이름을 가져옵니다. (다음에서 상속됨 TypeEntry) |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정한 개체와 현재 개체가 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 작동합니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
서버 활성화 클라이언트 형식의 전체 형식 이름, 어셈블리 이름 및 개체 URL을 .로 String반환합니다. |