RealProxy Konstruktoren

Definition

Initialisiert eine neue Instanz der RealProxy-Klasse.

Überlädt

RealProxy()

Initialisiert eine neue Instanz der RealProxy-Klasse mit Standardwerten.

RealProxy(Type)

Initialisiert eine neue Instanz der RealProxy-Klasse, die ein Remoteobjekt des angegebenen Type darstellt.

RealProxy(Type, IntPtr, Object)

Initialisiert eine neue Instanz der RealProxy-Klasse.

RealProxy()

Initialisiert eine neue Instanz der RealProxy-Klasse mit Standardwerten.

protected:
 RealProxy();
protected RealProxy ();
Protected Sub New ()

Beispiele

using namespace System;
using namespace System::Collections;
using namespace System::Runtime::Serialization;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Activation;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Proxies;
using namespace System::Runtime::Remoting::Messaging;
using namespace System::Runtime::Remoting::Contexts;
using namespace System::Security::Permissions;

ref class CustomServer;

[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)]
public ref class MyProxy: public RealProxy
{
private:
   String^ myUri;
   MarshalByRefObject^ myMarshalByRefObject;

public:
   MyProxy()
      : RealProxy()
   {
      Console::WriteLine( "MyProxy Constructor Called..." );
      myMarshalByRefObject = dynamic_cast<MarshalByRefObject^>(Activator::CreateInstance( CustomServer::typeid ));
      ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject );
      myUri = myObjRef->URI;
   }

        MyProxy( Type^ type1 )
      : RealProxy( type1 )
   {
      Console::WriteLine( "MyProxy Constructor Called..." );
      myMarshalByRefObject = dynamic_cast<MarshalByRefObject^>(Activator::CreateInstance( type1 ));
      ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject );
      myUri = myObjRef->URI;
   }

   MyProxy( Type^ type1, MarshalByRefObject^ targetObject )
      : RealProxy( type1 )
   {
      Console::WriteLine( "MyProxy Constructor Called..." );
      myMarshalByRefObject = targetObject;
      ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject );
      myUri = myObjRef->URI;
   }

   virtual IMessage^ Invoke( IMessage^ myMessage ) override
   {
      Console::WriteLine( "MyProxy 'Invoke method' Called..." );
      if ( dynamic_cast<IMethodCallMessage^>(myMessage) )
      {
         Console::WriteLine( "IMethodCallMessage*" );
      }

      if ( dynamic_cast<IMethodReturnMessage^>(myMessage) )
      {
         Console::WriteLine( "IMethodReturnMessage*" );
      }

      if ( dynamic_cast<IConstructionCallMessage^>(myMessage) )
      {
         // Initialize a new instance of remote object
         IConstructionReturnMessage^ myIConstructionReturnMessage = this->InitializeServerObject( static_cast<IConstructionCallMessage^>(myMessage) );
         ConstructionResponse^ constructionResponse = gcnew ConstructionResponse( nullptr,static_cast<IMethodCallMessage^>(myMessage) );
         return constructionResponse;
      }

      IDictionary^ myIDictionary = myMessage->Properties;
      IMessage^ returnMessage;
      myIDictionary[ "__Uri" ] = myUri;

      // Synchronously dispatch messages to server.
      returnMessage = ChannelServices::SyncDispatchMessage( myMessage );

      // Pushing return value and OUT parameters back onto stack.
      IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast<IMethodReturnMessage^>(returnMessage);
      return returnMessage;
   }

   virtual ObjRef^ CreateObjRef( Type^ ServerType ) override
   {
      Console::WriteLine( "CreateObjRef Method Called ..." );
      CustomObjRef ^ myObjRef = gcnew CustomObjRef( myMarshalByRefObject,ServerType );
      myObjRef->URI = myUri;
      return myObjRef;
   }

   [System::Security::Permissions::SecurityPermissionAttribute(
   System::Security::Permissions::SecurityAction::LinkDemand,
   Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)]
   virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override
   {
      // Add your custom data if any here.
      RealProxy::GetObjectData( info, context );
   }

   [System::Security::Permissions::SecurityPermissionAttribute(
   System::Security::Permissions::SecurityAction::Demand,
   Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)]
   [System::Security::Permissions::SecurityPermissionAttribute
   (System::Security::Permissions::SecurityAction::InheritanceDemand, 
   Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)]
   ref class CustomObjRef: public ObjRef
   {
   public:
      CustomObjRef( MarshalByRefObject^ myMarshalByRefObject, Type^ serverType )
         : ObjRef( myMarshalByRefObject, serverType )
      {
         Console::WriteLine( "ObjRef 'Constructor' called" );
      }

      // Override this method to store custom data.
      virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override
      {
         ObjRef::GetObjectData( info, context );
      }
   };
};

[AttributeUsageAttribute(AttributeTargets::Class)]
[System::Security::Permissions::SecurityPermissionAttribute
(System::Security::Permissions::SecurityAction::LinkDemand,
Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)]
[System::Security::Permissions::SecurityPermissionAttribute
(System::Security::Permissions::SecurityAction::InheritanceDemand,
Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)]
public ref class MyProxyAttribute: public ProxyAttribute
{
public:
   MyProxyAttribute(){}

   // Create an instance of ServicedComponentProxy
   virtual MarshalByRefObject^ CreateInstance( Type^ serverType ) override
   {
      return ProxyAttribute::CreateInstance( serverType );
   }

   virtual RealProxy^ CreateProxy( ObjRef^ objRef1, Type^ serverType, Object^ serverObject, Context^ serverContext ) override
   {
      MyProxy^ myCustomProxy = gcnew MyProxy( serverType );
      if ( serverContext != nullptr )
      {
         RealProxy::SetStubData( myCustomProxy, serverContext );
      }

      if ( ( !serverType->IsMarshalByRef) && (serverContext == nullptr) )
      {
         throw gcnew RemotingException( "Bad Type for CreateProxy" );
      }

      return myCustomProxy;
   }
};

[MyProxyAttribute]
ref class CustomServer: public ContextBoundObject
{
public:
   CustomServer()
   {
      Console::WriteLine( "CustomServer Base Class constructor called" );
   }

   void HelloMethod( String^ str )
   {
      Console::WriteLine( "HelloMethod of Server is invoked with message : {0}", str );
   }
};

// Acts as a custom proxy user.
int main()
{
   Console::WriteLine( "" );
   Console::WriteLine( "CustomProxy Sample" );
   Console::WriteLine( "================" );
   Console::WriteLine( "" );
   
   // Create an instance of MyProxy.
   MyProxy^ myProxyInstance = gcnew MyProxy( CustomServer::typeid );
   
   // Get a CustomServer proxy.
   CustomServer^ myHelloServer = static_cast<CustomServer^>(myProxyInstance->GetTransparentProxy());

   // Get stubdata.
   Console::WriteLine( "GetStubData = {0}", RealProxy::GetStubData( myProxyInstance ) );

   // Get ProxyType.
   Console::WriteLine( "Type of object represented by RealProxy is : {0}", myProxyInstance->GetProxiedType() );

   myHelloServer->HelloMethod( "RealProxy Sample" );
   Console::WriteLine( "" );

   // Get a reference object from server.
   Console::WriteLine( "Create an objRef object to be marshalled across Application Domains..." );
   ObjRef^ CustomObjRef = myProxyInstance->CreateObjRef( CustomServer::typeid );
   Console::WriteLine( "URI of 'ObjRef' object = {0}", CustomObjRef->URI );
   return 0;
}
using System;
using System.Collections;
using System.Runtime.Serialization;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Contexts;

namespace Samples
{
   [AttributeUsage(AttributeTargets.Class)]
   public class MyProxyAttribute : ProxyAttribute
   {
      public MyProxyAttribute()
      {
      }
      // Create an instance of ServicedComponentProxy
      public override MarshalByRefObject CreateInstance(Type serverType)
      {
         return base.CreateInstance(serverType);
      }
      public override RealProxy CreateProxy(ObjRef objRef1,
         Type serverType,
         object serverObject,
         Context serverContext)
      {
         MyProxy myCustomProxy = new MyProxy(serverType);
         if(serverContext != null)
         {
            RealProxy.SetStubData(myCustomProxy,serverContext);
         }
         if((!serverType.IsMarshalByRef)&&(serverContext == null))
         {
            throw new RemotingException("Bad Type for CreateProxy");
         }
         return myCustomProxy;
      }
   }
   [MyProxyAttribute]
   public class CustomServer :ContextBoundObject
   {
      public CustomServer()
      {
         Console.WriteLine("CustomServer Base Class constructor called");
      }
      public void HelloMethod(string str)
      {
         Console.WriteLine("HelloMethod of Server is invoked with message : " + str);
      }
   }
   public class MyProxy : RealProxy
   {
      String myUri;
      MarshalByRefObject myMarshalByRefObject;
      public MyProxy(): base()
      {
         Console.WriteLine("MyProxy Constructor Called...");
         myMarshalByRefObject = (MarshalByRefObject)Activator.CreateInstance(typeof(CustomServer));
         ObjRef myObjRef = RemotingServices.Marshal(myMarshalByRefObject);
         myUri = myObjRef.URI;
      }
      public MyProxy(Type type1): base(type1)
      {
         Console.WriteLine("MyProxy Constructor Called...");
         myMarshalByRefObject = (MarshalByRefObject)Activator.CreateInstance(type1);
         ObjRef myObjRef = RemotingServices.Marshal(myMarshalByRefObject);
         myUri = myObjRef.URI;
      }
      public MyProxy(Type type1, MarshalByRefObject targetObject) : base(type1)
      {
         Console.WriteLine("MyProxy Constructor Called...");
         myMarshalByRefObject = targetObject;
         ObjRef myObjRef = RemotingServices.Marshal(myMarshalByRefObject);
         myUri = myObjRef.URI;
      }
      public override IMessage Invoke(IMessage myMessage)
      {
         Console.WriteLine("MyProxy 'Invoke method' Called...");
         if (myMessage is IMethodCallMessage)
         {
            Console.WriteLine("IMethodCallMessage");
         }
         if (myMessage is IMethodReturnMessage)
         {
            Console.WriteLine("IMethodReturnMessage");
         }
         if (myMessage is IConstructionCallMessage)
         {
            // Initialize a new instance of remote object
            IConstructionReturnMessage myIConstructionReturnMessage =
               this.InitializeServerObject((IConstructionCallMessage)myMessage);
            ConstructionResponse constructionResponse = new
               ConstructionResponse(null,(IMethodCallMessage) myMessage);
            return constructionResponse;
         }
         IDictionary myIDictionary = myMessage.Properties;
         IMessage returnMessage;
         myIDictionary["__Uri"] = myUri;

         // Synchronously dispatch messages to server.
         returnMessage = ChannelServices.SyncDispatchMessage(myMessage);
         // Pushing return value and OUT parameters back onto stack.
         IMethodReturnMessage myMethodReturnMessage = (IMethodReturnMessage)returnMessage;
         return returnMessage;
      }
      public override ObjRef CreateObjRef(Type ServerType)
      {
         Console.WriteLine ("CreateObjRef Method Called ...");
         CustomObjRef myObjRef = new CustomObjRef(myMarshalByRefObject,ServerType);
         myObjRef.URI = myUri ;
         return myObjRef;
      }
      public override void GetObjectData( SerializationInfo info,
                                          StreamingContext context)
      {
         // Add your custom data if any here.
         base.GetObjectData(info, context);
      }
      public class CustomObjRef :ObjRef
      {
         public CustomObjRef(MarshalByRefObject myMarshalByRefObject,Type serverType):
                           base(myMarshalByRefObject,serverType)
         {
            Console.WriteLine("ObjRef 'Constructor' called");
         }
         // Override this method to store custom data.
         public override void GetObjectData(SerializationInfo info,
                                            StreamingContext context)
         {
            base.GetObjectData(info,context);
         }
      }
   }
   public class ProxySample
   {
      // Acts as a custom proxy user.
            public static void Main()
      {
         Console.WriteLine("");
         Console.WriteLine("CustomProxy Sample");
         Console.WriteLine("================");
         Console.WriteLine("");
         // Create an instance of MyProxy.
         MyProxy myProxyInstance = new MyProxy(typeof(CustomServer));
         // Get a CustomServer proxy.
         CustomServer myHelloServer = (CustomServer)myProxyInstance.GetTransparentProxy();
         // Get stubdata.
         Console.WriteLine("GetStubData = " + RealProxy.GetStubData(myProxyInstance).ToString());
         // Get ProxyType.
         Console.WriteLine("Type of object represented by RealProxy is :"
                           + myProxyInstance.GetProxiedType());
         myHelloServer.HelloMethod("RealProxy Sample");
         Console.WriteLine("");
         // Get a reference object from server.
         Console.WriteLine("Create an objRef object to be marshalled across Application Domains...");
         ObjRef CustomObjRef = myProxyInstance.CreateObjRef(typeof(CustomServer));
         Console.WriteLine("URI of 'ObjRef' object =  " + CustomObjRef.URI);
      }
   }
}
Imports System.Collections
Imports System.Runtime.Serialization
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Activation
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Proxies
Imports System.Runtime.Remoting.Messaging
Imports System.Runtime.Remoting.Contexts
Imports System.Security.Permissions

Namespace Samples
   <SecurityPermissionAttribute(SecurityAction.Demand, Flags := SecurityPermissionFlag.Infrastructure), _
   AttributeUsage(AttributeTargets.Class)>  _
   Public Class MyProxyAttribute
      Inherits ProxyAttribute

      Public Sub New()
      End Sub

      ' Create an instance of ServicedComponentProxy
      Public Overrides Function CreateInstance(serverType As Type) As MarshalByRefObject
         Return MyBase.CreateInstance(serverType)
      End Function 'CreateInstance

      Public Overrides Function CreateProxy(objRef1 As ObjRef, serverType As Type, _
                  serverObject As Object, serverContext As Context) As RealProxy
         Dim myCustomProxy As New MyProxy(serverType)
         If Not (serverContext Is Nothing) Then
            RealProxy.SetStubData(myCustomProxy, serverContext)
         End If
         If Not serverType.IsMarshalByRef And serverContext Is Nothing Then
            Throw New RemotingException("Bad Type for CreateProxy")
         End If
         Return myCustomProxy
      End Function 'CreateProxy
   End Class

   <MyProxyAttribute()> _
   Public Class CustomServer
      Inherits ContextBoundObject

      Public Sub New()
         Console.WriteLine("CustomServer Base Class constructor called")
      End Sub

      Public Sub HelloMethod(str As String)
         Console.WriteLine("HelloMethod of Server is invoked with message : " + str)
      End Sub
   End Class
   <PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
   Public Class MyProxy
      Inherits RealProxy
      Private myUri As String
      Private myMarshalByRefObject As MarshalByRefObject

      Public Sub New()
         MyBase.New()
         Console.WriteLine("MyProxy Constructor Called...")
         myMarshalByRefObject = _
               CType(Activator.CreateInstance(GetType(CustomServer)), MarshalByRefObject)
         Dim myObjRef As ObjRef = RemotingServices.Marshal(myMarshalByRefObject)
         myUri = myObjRef.URI
      End Sub

      Public Sub New(type1 As Type)
         MyBase.New(type1)
         Console.WriteLine("MyProxy Constructor Called...")
         myMarshalByRefObject = CType(Activator.CreateInstance(type1), MarshalByRefObject)
         Dim myObjRef As ObjRef = RemotingServices.Marshal(myMarshalByRefObject)
         myUri = myObjRef.URI
      End Sub

      Public Sub New(type1 As Type, targetObject As MarshalByRefObject)
         MyBase.New(type1)
         Console.WriteLine("MyProxy Constructor Called...")
         myMarshalByRefObject = targetObject
         Dim myObjRef As ObjRef = RemotingServices.Marshal(myMarshalByRefObject)
         myUri = myObjRef.URI
      End Sub

      Public Overrides Function Invoke(myMessage As IMessage) As IMessage
         Console.WriteLine("MyProxy 'Invoke method' Called...")
         If TypeOf myMessage Is IMethodCallMessage Then
            Console.WriteLine("IMethodCallMessage")
         End If
         If TypeOf myMessage Is IMethodReturnMessage Then
            Console.WriteLine("IMethodReturnMessage")
         End If
         If TypeOf myMessage Is IConstructionCallMessage Then
            ' Initialize a new instance of remote object
            Dim myIConstructionReturnMessage As IConstructionReturnMessage = _
                  Me.InitializeServerObject(CType(myMessage, IConstructionCallMessage))
            Dim constructionResponse As _
                  New ConstructionResponse(Nothing, CType(myMessage, IMethodCallMessage))
            Return constructionResponse
         End If
         Dim myIDictionary As IDictionary = myMessage.Properties
         Dim returnMessage As IMessage
         myIDictionary("__Uri") = myUri
         ' Synchronously dispatch messages to server.
         returnMessage = ChannelServices.SyncDispatchMessage(myMessage)
         ' Pushing return value and OUT parameters back onto stack.
         Dim myMethodReturnMessage As IMethodReturnMessage = _
               CType(returnMessage, IMethodReturnMessage)
         Return returnMessage
      End Function 'Invoke

      Public Overrides Function CreateObjRef(ServerType As Type) As ObjRef
         Console.WriteLine("CreateObjRef Method Called ...")
         Dim myObjRef As New CustomObjRef(myMarshalByRefObject, ServerType)
         myObjRef.URI = myUri
         Return myObjRef
      End Function 'CreateObjRef

      Public Overrides Sub GetObjectData(info As SerializationInfo, context As StreamingContext)
         ' Add your custom data if any here.
         MyBase.GetObjectData(info, context)
      End Sub
      <PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
      Public Class CustomObjRef
         Inherits ObjRef
         Public Sub New(myMarshalByRefObject As MarshalByRefObject, serverType As Type)
            MyBase.New(myMarshalByRefObject, serverType)
            Console.WriteLine("ObjRef 'Constructor' called")
         End Sub

         ' Override this method to store custom data.
         <SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter:=true)> _
         Public Overrides Sub GetObjectData(info As SerializationInfo, context As StreamingContext)
            MyBase.GetObjectData(info, context)
         End Sub
      End Class
   End Class
   
   <PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
   Public Class ProxySample
      ' Acts as a custom proxy user.
      Public Shared Sub Main()
         Console.WriteLine("")
         Console.WriteLine("CustomProxy Sample")
         Console.WriteLine("================")
         Console.WriteLine("")
         ' Create an instance of MyProxy.
         Dim myProxyInstance As New MyProxy(GetType(CustomServer))
         ' Get a CustomServer proxy.
         Dim myHelloServer As CustomServer = _
                     CType(myProxyInstance.GetTransparentProxy(), CustomServer)
         ' Get stubdata.
         Console.WriteLine("GetStubData = " + RealProxy.GetStubData(myProxyInstance).ToString())
         ' Get ProxyType.
         Console.WriteLine("Type of object represented by RealProxy is :" + _
                                                myProxyInstance.GetProxiedType().ToString())
         myHelloServer.HelloMethod("RealProxy Sample")
         Console.WriteLine("")
         ' Get a reference object from server.
         Console.WriteLine("Create an objRef object to be marshalled across Application Domains...")
         Dim CustomObjRef As ObjRef = myProxyInstance.CreateObjRef(GetType(CustomServer))
         Console.WriteLine("URI of 'ObjRef' object =  " + CustomObjRef.URI)
      End Sub
   End Class
End Namespace 'Samples.AspNet.VB

Gilt für:

RealProxy(Type)

Initialisiert eine neue Instanz der RealProxy-Klasse, die ein Remoteobjekt des angegebenen Type darstellt.

protected:
 RealProxy(Type ^ classToProxy);
protected RealProxy (Type classToProxy);
[System.Security.SecurityCritical]
protected RealProxy (Type classToProxy);
new System.Runtime.Remoting.Proxies.RealProxy : Type -> System.Runtime.Remoting.Proxies.RealProxy
[<System.Security.SecurityCritical>]
new System.Runtime.Remoting.Proxies.RealProxy : Type -> System.Runtime.Remoting.Proxies.RealProxy
Protected Sub New (classToProxy As Type)

Parameter

classToProxy
Type

Der Type des Remoteobjekts, für das ein Proxy erstellt werden soll.

Attribute

Ausnahmen

classToProxy ist keine Schnittstelle und wird auch nicht von MarshalByRefObject abgeleitet.

Beispiele

// Create an instance of MyProxy.
MyProxy^ myProxyInstance = gcnew MyProxy( CustomServer::typeid );

// Get a CustomServer proxy.
CustomServer^ myHelloServer = static_cast<CustomServer^>(myProxyInstance->GetTransparentProxy());
// Create an instance of MyProxy.
MyProxy myProxyInstance = new MyProxy(typeof(CustomServer));
// Get a CustomServer proxy.
CustomServer myHelloServer = (CustomServer)myProxyInstance.GetTransparentProxy();
' Create an instance of MyProxy.
Dim myProxyInstance As New MyProxy(GetType(CustomServer))
' Get a CustomServer proxy.
Dim myHelloServer As CustomServer = _
            CType(myProxyInstance.GetTransparentProxy(), CustomServer)

Hinweise

Die aktuelle Methode erstellt einen transparenten Proxy, auf den über die GetTransparentProxy -Methode zugegriffen werden kann.

Ein Client, der ein Objekt über eine beliebige Remotinggrenze hinweg verwendet, verwendet tatsächlich einen transparenten Proxy für das Objekt. Der transparente Proxy vermittelt den Eindruck, dass sich das tatsächliche Objekt im Bereich des Clients befindet. Dies wird erreicht, indem Aufrufe an das reale Objekt mithilfe der Remotinginfrastruktur weitergeleitet werden.

Der transparente Proxy wird in einem instance einer verwalteten Laufzeitklasse RealProxyuntergebracht. RealProxy Implementiert einen Teil der Funktionalität, die erforderlich ist, um die Vorgänge vom transparenten Proxy weiterzuleiten. Beachten Sie, dass ein Proxyobjekt die zugeordnete Semantik verwalteter Objekte erbt, z. B. Garbage Collection und Unterstützung für Felder und Methoden, und kann erweitert werden, um neue Klassen zu bilden. Der Proxy hat einen dualen Charakter: Er fungiert als Objekt derselben Klasse wie das Remoteobjekt (transparenter Proxy) und ist selbst ein verwaltetes Objekt.

Gilt für:

RealProxy(Type, IntPtr, Object)

Initialisiert eine neue Instanz der RealProxy-Klasse.

protected:
 RealProxy(Type ^ classToProxy, IntPtr stub, System::Object ^ stubData);
protected RealProxy (Type classToProxy, IntPtr stub, object stubData);
[System.Security.SecurityCritical]
protected RealProxy (Type classToProxy, IntPtr stub, object stubData);
new System.Runtime.Remoting.Proxies.RealProxy : Type * nativeint * obj -> System.Runtime.Remoting.Proxies.RealProxy
[<System.Security.SecurityCritical>]
new System.Runtime.Remoting.Proxies.RealProxy : Type * nativeint * obj -> System.Runtime.Remoting.Proxies.RealProxy
Protected Sub New (classToProxy As Type, stub As IntPtr, stubData As Object)

Parameter

classToProxy
Type

Der Type des Remoteobjekts, für das ein Proxy erstellt werden soll.

stub
IntPtr

nativeint

Ein Stub, der der neuen Proxyinstanz zugeordnet werden soll.

stubData
Object

Die für den angegebenen Stub und die neue Proxyinstanz festzulegenden Stubdaten.

Attribute

Ausnahmen

classToProxy ist keine Schnittstelle und wird auch nicht von MarshalByRefObject abgeleitet.

Hinweise

Die Stubdaten werden von benutzerdefinierten Proxybenutzern verwendet, um zu entscheiden, was mit einem eingehenden Methodenaufruf geschehen soll. Beispielsweise können die Stubdaten Informationen über den Kontext des Servers sein, mit denen Sie bestimmen können, ob der Aufruf lokal ausgeführt oder über die Remotinginfrastruktur gesendet werden soll.

Gilt für: