所以我的命名管道声明如下:
DuplexChannelFactory<IServiceHandler> pipeFactory;pipeFactory =
new DuplexChannelFactory<IServiceHandler>(
myCallbacks,
new NetNamedPipeBinding(),
new EndpointAddress(
"net.pipe://localhost/Server"));
pipeProxy = pipeFactory.CreateChannel();
(这项工作)
我想把配置放在app.config文件中,所以我去那里做成:
<client>
<endpoint address="net.pipe://localhost/Server" binding="netNamedPipeBinding"
bindingConfiguration="netNamedPipeBinding" contract="WCFClient.IServiceHandler"
name="ClientEndpointinClient" />
.
.
.
然后从声明中删除配置:
pipeFactory =
new DuplexChannelFactory<IServiceHandler>(
myCallbacks);
pipeProxy = pipeFactory.CreateChannel();
不要担心回调,它们声明得很好。 但是当我尝试创建通道时,它表示端点为空...
我错过了什么?
答案 0 :(得分:1)
将端点名称作为string
或EndpointAddress
实例传递到CreateChannel()
方法调用中。