"景先生毕设|www.jxszl.com

C# ChannelAdapter类代码示例

2023-12-29 17:42编辑: www.jxszl.com景先生毕设
本文整理汇总了C#中ChannelAdapter类的典型用法代码示例。如果您正苦于以下问题:C#ChannelAdapter类的具体用法?C#ChannelAdapter怎么用?C#ChannelAdapter使用的例子?这里精选的类代码示例或许可以为您提供帮助。 示例1:Should_property_adapt_itself_to_a_channel_network publicvoidShould_property_adapt_itself_to_a_channel_network() { TraceLogger.Configure(LogLevel.Debug); ILoggerlog=Logger.GetLogger(); log.Debug("Starting"); varserviceUri=newUri("net.pipe://localhost/Pipe"); stringpipeName="Test"; Channeladapter=newChannelAdapter(); using(varhost=newWcfChannelHost(adapter,serviceUri,pipeName)) { log.Debug("Hoststarted"); varfuture=newFuture(); using(adapter.Connect(x=> { x.AddConsumer(m=> { log.Debug(l=>l.Write("Received:{0}",m.Value)); future.Complete(m); }); })) { varclient=newWcfChannelProxy(newSynchronousFiber(),serviceUri,pipeName); log.Debug("Clientstarted"); client.Send(newTestMessage("Hello!")); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); log.Debug("Complete"); } } }
原文链接:http://www.jxszl.com/biancheng/C/556720.html