BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack, IMessage, ITransportHeaders, Stream, IMessage, ITransportHeaders, Stream) 方法

定义

请求从当前接收器处理消息。Requests message processing from the current sink.

public:
 virtual System::Runtime::Remoting::Channels::ServerProcessing ProcessMessage(System::Runtime::Remoting::Channels::IServerChannelSinkStack ^ sinkStack, System::Runtime::Remoting::Messaging::IMessage ^ requestMsg, System::Runtime::Remoting::Channels::ITransportHeaders ^ requestHeaders, System::IO::Stream ^ requestStream, [Runtime::InteropServices::Out] System::Runtime::Remoting::Messaging::IMessage ^ % responseMsg, [Runtime::InteropServices::Out] System::Runtime::Remoting::Channels::ITransportHeaders ^ % responseHeaders, [Runtime::InteropServices::Out] System::IO::Stream ^ % responseStream);
public System.Runtime.Remoting.Channels.ServerProcessing ProcessMessage (System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Messaging.IMessage responseMsg, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream);
abstract member ProcessMessage : System.Runtime.Remoting.Channels.IServerChannelSinkStack * System.Runtime.Remoting.Messaging.IMessage * System.Runtime.Remoting.Channels.ITransportHeaders * System.IO.Stream * IMessage * ITransportHeaders * Stream -> System.Runtime.Remoting.Channels.ServerProcessing
override this.ProcessMessage : System.Runtime.Remoting.Channels.IServerChannelSinkStack * System.Runtime.Remoting.Messaging.IMessage * System.Runtime.Remoting.Channels.ITransportHeaders * System.IO.Stream * IMessage * ITransportHeaders * Stream -> System.Runtime.Remoting.Channels.ServerProcessing
Public Function ProcessMessage (sinkStack As IServerChannelSinkStack, requestMsg As IMessage, requestHeaders As ITransportHeaders, requestStream As Stream, ByRef responseMsg As IMessage, ByRef responseHeaders As ITransportHeaders, ByRef responseStream As Stream) As ServerProcessing

参数

sinkStack
IServerChannelSinkStack

调用了当前接收器的信道接收器的堆栈。A stack of channel sinks that called the current sink.

requestMsg
IMessage

包含请求的消息。The message that contains the request.

requestHeaders
ITransportHeaders

从来自客户端的传入消息中检索到的标头。Headers that are retrieved from the incoming message from the client.

requestStream
Stream

需要被处理并传递到反序列化接收器的流。The stream that needs to be processed and passed on to the deserialization sink.

responseMsg
IMessage

此方法返回时,包含持有响应消息的 IMessageWhen this method returns, contains a IMessage that holds the response message. 此参数未经初始化即被传递。This parameter is passed uninitialized.

responseHeaders
ITransportHeaders

此方法返回时,包含一个 ITransportHeaders,它持有要添加到将发往客户端的返回消息的标头。When this method returns, contains a ITransportHeaders that holds the headers to add to the return message that is heading to the client. 此参数未经初始化即被传递。This parameter is passed uninitialized.

responseStream
Stream

当此方法返回时,包含传向传输接收器的 StreamWhen this method returns, contains a Stream that is heading to the transport sink. 此参数未经初始化即被传递。This parameter is passed uninitialized.

返回

ServerProcessing

ServerProcessing 状态值,提供有关如何处理消息的信息。A ServerProcessing status value that provides information about how the message was processed.

实现

注解

代理的作业是将其上调用的方法调用转换为消息。The proxy's job is to convert a method call that is invoked on it into a message. 用于实现接口的消息 IMessage 通过调用消息接收器对象从客户端传递到服务器端 ProcessMessageThe message, which implements the IMessage interface, is passed from the client end to the server end by invoking ProcessMessage on message sink objects. 消息接收器链接在一起,这意味着每个消息接收器负责 ProcessMessage 在当前消息接收器完成其工作后,在下一个消息接收器上调用。Message sinks are chained together, which means that every message sink is responsible for calling ProcessMessage on the next message sink after the current message sink has finished its work. 例如,与同步相关的消息接收器可能会导致获取或释放锁,并将锁委托给下游消息接收器。For instance, a synchronization-related message sink might cause a lock to be acquired or released and delegated to the downstream message sink.

当格式化程序信道接收器获取需要通过通道发送的消息时,它会调用并将 SyncProcessMessage 消息作为参数传递。When the formatter channel sink gets a message that needs to be sent over the channel, it calls SyncProcessMessage, passing the message as a parameter. 然后,格式化程序接收器创建传输标头数组,并 GetRequestStream 在格式化程序接收器上调用。The formatter sink then creates the transport header array and calls GetRequestStream on the formatter sink. 此调用将被转发到接收器链,并且任何接收器都可以创建将传递回格式化程序接收器的请求流。This call is forwarded down the sink chain, and any sink can create a request stream that will be passed back to the formatter sink. 此调用返回后,将对消息进行序列化,在 ProcessMessage 接收器链中的第一个链上调用,并将消息传递给信道接收器。After this call returns, the message is serialized, ProcessMessage is called on the first chain in the sink chain, and the message is passed to the channel sinks.

信道接收器收到消息后,可以将数据写入流,将标头添加到标头数组,并在将调用转发到下一个接收器之前,将它们添加到接收器堆栈。After the channel sinks get the message, they can write data to the stream, add headers to the header array, and add themselves to the sink stack before forwarding the call to the next sink. 当调用到达链末尾的传输接收器时,传输接收器会将标头和序列化消息通过通道发送到服务器,在此过程中,进程会反向进行。When the call reaches the transport sink at the end of the chain, the transport sink sends the headers and serialized message over the channel to the server, where the process is reversed.

当消息到达服务器端时,传输接收器将从流中检索标头和序列化消息,并通过接收器链转发这些消息,直到到达格式化程序接收器。When the message gets to the server side, the transport sink retrieves the headers and serialized message from the stream and forwards these through the sink chain until the formatter sink is reached. 格式化程序接收器然后对消息进行反序列化,并将其转发到远程处理基础结构。The formatter sink then deserializes the message and forwards it to the remoting infrastructure. 然后,远程处理基础结构将消息转换为方法调用,并调用服务器对象。Then, the remoting infrastructure turns the message into a method call, and calls the server object.

适用于