IClientChannelSinkProvider.CreateSink(IChannelSender, String, Object) 方法

定义

创建接收器链。

public:
 System::Runtime::Remoting::Channels::IClientChannelSink ^ CreateSink(System::Runtime::Remoting::Channels::IChannelSender ^ channel, System::String ^ url, System::Object ^ remoteChannelData);
public System.Runtime.Remoting.Channels.IClientChannelSink CreateSink (System.Runtime.Remoting.Channels.IChannelSender channel, string url, object remoteChannelData);
[System.Security.SecurityCritical]
public System.Runtime.Remoting.Channels.IClientChannelSink CreateSink (System.Runtime.Remoting.Channels.IChannelSender channel, string url, object remoteChannelData);
abstract member CreateSink : System.Runtime.Remoting.Channels.IChannelSender * string * obj -> System.Runtime.Remoting.Channels.IClientChannelSink
[<System.Security.SecurityCritical>]
abstract member CreateSink : System.Runtime.Remoting.Channels.IChannelSender * string * obj -> System.Runtime.Remoting.Channels.IClientChannelSink
Public Function CreateSink (channel As IChannelSender, url As String, remoteChannelData As Object) As IClientChannelSink

参数

channel
IChannelSender

信道,为其构造当前接收器链。

url
String

要连接到的对象的 URL。 如果连接完全基于 remoteChannelData 参数中包含的信息,则该参数可以为 null

remoteChannelData
Object

描述远程服务器上的信道的信道数据对象。

返回

新生成的信道接收器链中的第一个接收器,或 null(指示此提供程序将不会或不能为此终结点提供连接)。

属性

例外

直接调用方没有基础结构权限。

示例

下面的代码示例演示了此方法的实现。

virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ url, Object^ remoteChannelData )
{
   Console::WriteLine( "Creating ClientSink for {0}", url );
   
   // Create the next sink in the chain.
   IClientChannelSink^ nextSink = nextProvider->CreateSink( channel, url, remoteChannelData );
   
   // Hook our sink up to it.
   return (gcnew ClientSink( nextSink ));
}
public IClientChannelSink CreateSink (IChannelSender channel, String url, Object remoteChannelData)
{

    Console.WriteLine("Creating ClientSink for {0}", url);

    // Create the next sink in the chain.
    IClientChannelSink nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);

    // Hook our sink up to it.
    return( new ClientSink(nextSink) );
}

注解

CreateSink调用 方法时,它会创建自己的通道接收器,将CreateSink调用转发到链中的下一个接收器提供程序, (是否有一个) ,并确保下一个接收器和当前接收器链接在一起。

适用于