我对代理和通道感到困惑。根据我的阅读,WCF客户端使用一个代理来通过一系列通道传递消息。每个通道都负责特定的任务,例如一个通道用于编码消息,另一个通道用于加密。
当我看到以下代码时,我的困惑开始了:
When
proxy.MyMethod()
is called, it actually called the whole chain of channels?The author used method called
CreateChannel
and named the identifier proxy. So in WCF architecture Proxy is just a spacial high level channel, it is not a stand alone architecture element?Binding binding = new NetTcpBinding(); EndpointAddress address = new EndpointAddress("net.tcp://localhost:8000"); IMyContract proxy = ChannelFactory<IMyContract>.CreateChannel(binding,address); using(proxy as IDisposable) { proxy.MyMethod(); }