WellKnownClientTypeEntry Sınıf
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
İstemcide sunucu tarafından etkinleştirilmiş bir tür (tek çağrı veya tekil) olarak kaydedilen nesne türünün değerlerini tutar.
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
- Devralma
- Öznitelikler
Örnekler
#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
Açıklamalar
Sunucu tarafından etkinleştirilen türler tek çağrı veya tekil olabilir. Bir sınıf tek bir çağrı türü olarak kaydedilirse, istemciden her çağrı geldiğinde yeni bir örnek oluşturulur. Tek bir nesneye yapılan tüm çağrılar, nesne toplanmadığı sürece bu nesnenin bir örneği tarafından işlenir.
Kayıtlı sunucu tarafından etkinleştirilen nesnenin URI'sini bilen herhangi bir istemci, tercih ChannelServices ettiği kanalı kaydederek ve veya Activator.GetObjectçağırarak new nesneyi etkinleştirerek bu nesne için bir proxy alabilir. ile newsunucu tarafından etkinleştirilmiş bir nesneyi etkinleştirmek için, önce yöntemini kullanarak RegisterWellKnownClientType istemcide sunucu tarafından etkinleştirilmiş nesne türünü kaydetmeniz gerekir. çağrısı RegisterWellKnownClientTypeyaparak uzaktan iletişim altyapısına uzak nesnenin konumunu vermiş olursunuz ve bu da anahtar sözcüğün new bunu oluşturmasına olanak tanır. Öte yandan, sunucu tarafından etkinleştirilmiş bir nesneyi etkinleştirmek için yöntemini kullanırsanız Activator.GetObject , nesnenin URL'sini bağımsız değişken olarak sağlamanız gerekir; bu nedenle istemcide önceden kayıt yapılması gerekmez.
Oluşturucular
| Name | Description |
|---|---|
| WellKnownClientTypeEntry(String, String, String) |
Verilen tür, derleme adı ve URL ile sınıfın WellKnownClientTypeEntry yeni bir örneğini başlatır. |
| WellKnownClientTypeEntry(Type, String) |
Verilen tür ve URL ile sınıfının yeni bir örneğini WellKnownClientTypeEntry başlatır. |
Özellikler
| Name | Description |
|---|---|
| ApplicationUrl |
Türü etkinleştirmek için uygulamanın URL'sini alır veya ayarlar. |
| AssemblyName |
Uzaktan etkinleştirilen bir tür olarak yapılandırılan nesne türünün derleme adını alır. (Devralındığı yer: TypeEntry) |
| ObjectType |
Type Sunucu tarafından etkinleştirilmiş istemci türünün alır. |
| ObjectUrl |
Sunucu tarafından etkinleştirilen istemci nesnesinin URL'sini alır. |
| TypeName |
Uzaktan etkinleştirilmiş bir tür olarak yapılandırılan nesne türünün tam tür adını alır. (Devralındığı yer: TypeEntry) |
Yöntemler
| Name | Description |
|---|---|
| Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler. (Devralındığı yer: Object) |
| GetHashCode() |
Varsayılan karma işlevi işlevi görür. (Devralındığı yer: Object) |
| GetType() |
Geçerli örneğin Type alır. (Devralındığı yer: Object) |
| MemberwiseClone() |
Geçerli Objectbasit bir kopyasını oluşturur. (Devralındığı yer: Object) |
| ToString() |
Sunucu tarafından etkinleştirilen istemci türünün tam tür adını, derleme adını ve nesne URL'sini olarak Stringdöndürür. |