2

所以我有我的命名管道声明如下:

        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();

不用担心回调,它们已经很好地声明了。但是当我尝试创建通道时,它说端点为空......

我错过了什么?

4

1 回答 1

1

将端点名称作为stringEndpointAddress实例传递到CreateChannel()方法调用中。

于 2013-07-30T19:27:34.510 回答