Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Initialisiert eine neue Instanz des Objekt-Type des Remoteobjekts, das die aktuelle Instanz des RealProxy darstellt, mit der angegebenen IConstructionCallMessage.
Namespace: System.Runtime.Remoting.Proxies
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<ComVisibleAttribute(True)> _
Public Function InitializeServerObject ( _
ctorMsg As IConstructionCallMessage _
) As IConstructionReturnMessage
'Usage
Dim instance As RealProxy
Dim ctorMsg As IConstructionCallMessage
Dim returnValue As IConstructionReturnMessage
returnValue = instance.InitializeServerObject(ctorMsg)
[ComVisibleAttribute(true)]
public IConstructionReturnMessage InitializeServerObject (
IConstructionCallMessage ctorMsg
)
[ComVisibleAttribute(true)]
public:
IConstructionReturnMessage^ InitializeServerObject (
IConstructionCallMessage^ ctorMsg
)
/** @attribute ComVisibleAttribute(true) */
public IConstructionReturnMessage InitializeServerObject (
IConstructionCallMessage ctorMsg
)
ComVisibleAttribute(true)
public function InitializeServerObject (
ctorMsg : IConstructionCallMessage
) : IConstructionReturnMessage
Parameter
- ctorMsg
Eine Meldung des Konstruktionsaufrufs, die die Konstruktorparameter für die neue Instanz des vom aktuellen RealProxy dargestellten Remoteobjekts enthält. Diese kann NULL (Nothing in Visual Basic) sein.
Rückgabewert
Das Ergebnis der Konstruktionsanforderung.
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Der direkte Aufrufer verfügt nicht über die UnmanagedCode-Berechtigung. |
Hinweise
Wenn der ctorMsg-Parameter NULL (Nothing in Visual Basic) ist, ruft die InitializeServerObject-Methode den Standardkonstruktor für die neue Instanz des Remoteobjekts auf, das vom aktuellen RealProxy dargestellt wird.
Beispiel
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 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;
}
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;
}
.NET Framework-Sicherheit
- SecurityPermission zum Aufrufen von nicht verwaltetem Code. Anforderungswert: SecurityAction.LinkDemand; Berechtigungswert: SecurityPermissionFlag.UnmanagedCode
Plattformen
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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
RealProxy-Klasse
RealProxy-Member
System.Runtime.Remoting.Proxies-Namespace