IOutputChannel.Send 方法

定义

在当前输出通道上发送一条消息。

重载

Send(Message)

向输出通道的目标传输一条消息。

Send(Message, TimeSpan)

在指定时间间隔内在当前输出通道上发送一条消息。

Send(Message)

向输出通道的目标传输一条消息。

public:
 void Send(System::ServiceModel::Channels::Message ^ message);
public void Send (System.ServiceModel.Channels.Message message);
abstract member Send : System.ServiceModel.Channels.Message -> unit
Public Sub Send (message As Message)

参数

message
Message

将在输出通道上发送的 Message

示例

下面的代码演示如何实现此方法:

public IAsyncResult BeginTryReceiveRequest(TimeSpan timeout, AsyncCallback callback, object state)
{
    TryReceiveRequestAsyncResult result = new TryReceiveRequestAsyncResult(this, timeout, callback, state);
    result.Begin();
    return result;
}

注解

输出通道上发出的消息的目标是在通道创建时指定的。

Send 方法不对到远程终结点的消息传递进行保证。 出于各种原因,IOutputChannel 的实现可能在不提示的情况下丢弃消息。 例如,没有更多的缓冲区空间。 如果需要传递保证,则使用 IOutputSessionChannel

将消息传递到输出通道中会导致消息被使用。 在调用 Send 后,就再也不能检查消息或对消息调用 Close

适用于

Send(Message, TimeSpan)

在指定时间间隔内在当前输出通道上发送一条消息。

public:
 void Send(System::ServiceModel::Channels::Message ^ message, TimeSpan timeout);
public void Send (System.ServiceModel.Channels.Message message, TimeSpan timeout);
abstract member Send : System.ServiceModel.Channels.Message * TimeSpan -> unit
Public Sub Send (message As Message, timeout As TimeSpan)

参数

message
Message

将在输出通道上发送的 Message

timeout
TimeSpan

TimeSpan,指定在超时前必须完成发送操作的时间。

示例

下面的代码演示如何实现此方法:

public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext requestContext)
{
    return TryReceiveRequestAsyncResult.End(result, out requestContext);
}

注解

输出通道上发出的消息的目标是在通道创建时指定的。

Send 方法不对到远程终结点的消息传递进行保证。 出于各种原因,IOutputChannel 的实现可能在不提示的情况下丢弃消息。 例如,没有更多的缓冲区空间。 如果需要传递保证,则使用 IOutputSessionChannel

将消息传递到输出通道中会导致消息被使用。 在调用 Send 后,就再也不能检查消息或对消息调用 Close

实施者说明

如果超出指定的 TimeoutException,则操作应引发 timeout

适用于