RemotingServices.Connect Yöntem
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.
İyi bilinen bir nesne için ara sunucu oluşturur.
Aşırı Yüklemeler
| Connect(Type, String) |
ve URL'si göz önüne alındığında Type , iyi bilinen bir nesne için bir proxy oluşturur. |
| Connect(Type, String, Object) |
, URL ve kanala özgü veriler göz önünde bulundurularak Type, iyi bilinen bir nesne için bir proxy oluşturur. |
Connect(Type, String)
ve URL'si göz önüne alındığında Type , iyi bilinen bir nesne için bir proxy oluşturur.
public:
static System::Object ^ Connect(Type ^ classToProxy, System::String ^ url);
public static object Connect (Type classToProxy, string url);
[System.Runtime.InteropServices.ComVisible(true)]
public static object Connect (Type classToProxy, string url);
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public static object Connect (Type classToProxy, string url);
static member Connect : Type * string -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
static member Connect : Type * string -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
static member Connect : Type * string -> obj
Public Shared Function Connect (classToProxy As Type, url As String) As Object
Parametreler
- url
- String
Sunucu sınıfının URL'si.
Döndürülenler
Belirtilen iyi bilinen nesne tarafından hizmet edilen bir uç noktaya işaret eden uzak nesnenin ara sunucusu.
- Öznitelikler
Özel durumlar
Hemen çağıranın uzaktan iletişim türlerini ve kanallarını yapılandırma izni yoktur.
Örnekler
Aşağıdaki kod örneği, iyi bilinen bir nesneye proxy oluşturmak için yönteminin nasıl kullanılacağını Connect gösterir.
Console::WriteLine( "Connecting to SampleNamespace::SampleWellKnown." );
SampleWellKnown ^ proxy = dynamic_cast<SampleWellKnown^>(RemotingServices::Connect( SampleWellKnown::typeid, const_cast<String^>(SERVER_URL) ));
Console::WriteLine( "Connected to SampleWellKnown" );
// Verifies that the Object* reference is to a transparent proxy.
if ( RemotingServices::IsTransparentProxy( proxy ) )
Console::WriteLine( "proxy is a reference to a transparent proxy." );
else
Console::WriteLine( "proxy is not a transparent proxy. This is unexpected." );
// Calls a method on the server Object*.
Console::WriteLine( "proxy->Add returned {0}.", proxy->Add( 2, 3 ) );
Console.WriteLine("Connecting to SampleNamespace.SampleWellKnown.");
SampleWellKnown proxy =
(SampleWellKnown)RemotingServices.Connect(typeof(SampleWellKnown), SERVER_URL);
Console.WriteLine("Connected to SampleWellKnown");
// Verifies that the object reference is to a transparent proxy.
if (RemotingServices.IsTransparentProxy(proxy))
Console.WriteLine("proxy is a reference to a transparent proxy.");
else
Console.WriteLine("proxy is not a transparent proxy. This is unexpected.");
// Calls a method on the server object.
Console.WriteLine("proxy.Add returned {0}.", proxy.Add(2, 3));
Console.WriteLine("Connecting to SampleNamespace.SampleWellKnown.")
Dim proxy As SampleWellKnown = _
CType(RemotingServices.Connect(GetType(SampleWellKnown), SERVER_URL), SampleWellKnown)
Console.WriteLine("Connected to SampleWellKnown")
' Verifies that the object reference is to a transparent proxy.
If RemotingServices.IsTransparentProxy(proxy) Then
Console.WriteLine("proxy is a reference to a transparent proxy.")
Else
Console.WriteLine("proxy is not a transparent proxy. This is unexpected.")
End If
' Calls a method on the server object.
Console.WriteLine("proxy.Add returned {0}.", proxy.Add(2, 3))
Açıklamalar
Döndürülen proxy nesnesi, belirtilen iyi bilinen nesne tarafından sunulan bir uç noktaya işaret etmektedir. Ara sunucuda bir yöntem çağrılana kadar ağ üzerinden ileti gönderilmez.
Şunlara uygulanır
Connect(Type, String, Object)
, URL ve kanala özgü veriler göz önünde bulundurularak Type, iyi bilinen bir nesne için bir proxy oluşturur.
public:
static System::Object ^ Connect(Type ^ classToProxy, System::String ^ url, System::Object ^ data);
public static object Connect (Type classToProxy, string url, object data);
[System.Runtime.InteropServices.ComVisible(true)]
public static object Connect (Type classToProxy, string url, object data);
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public static object Connect (Type classToProxy, string url, object data);
static member Connect : Type * string * obj -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
static member Connect : Type * string * obj -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
static member Connect : Type * string * obj -> obj
Public Shared Function Connect (classToProxy As Type, url As String, data As Object) As Object
Parametreler
- url
- String
İyi bilinen nesnenin URL'si.
- data
- Object
Kanala özgü veriler. olabilir null.
Döndürülenler
İstenen iyi bilinen nesne tarafından sunulan bir uç noktaya işaret eden bir ara sunucu.
- Öznitelikler
Özel durumlar
Hemen çağıranın uzaktan iletişim türlerini ve kanallarını yapılandırma izni yoktur.
Açıklamalar
Döndürülen proxy nesnesi, belirtilen iyi bilinen nesne tarafından sunulan bir uç noktaya işaret etmektedir. Ara sunucuda bir yöntem çağrılana kadar ağ üzerinden ileti gönderilmez.
data nesnesi, kanala bilgi iletmek için kullanılır ve yöntemine IChannelSender.CreateMessageSink geçirilir.