简体   繁体   English

在app.config中配置的WCF命名管道不起作用

[英]WCF Named pipe configured in app.config does not work

So I have my named pipe declared like this: 所以我有这样声明的命名管道:

        DuplexChannelFactory<IServiceHandler> pipeFactory;pipeFactory =
              new DuplexChannelFactory<IServiceHandler>(
                  myCallbacks,
                 new NetNamedPipeBinding(),
                 new EndpointAddress(
                    "net.pipe://localhost/Server"));
        pipeProxy = pipeFactory.CreateChannel();

(THIS WORKS) (此工作)

I want to put the configuration in the app.config file so I go there and make it: 我想将配置放在app.config文件中,所以我去做了:

<client>
  <endpoint address="net.pipe://localhost/Server" binding="netNamedPipeBinding"
    bindingConfiguration="netNamedPipeBinding" contract="WCFClient.IServiceHandler"
    name="ClientEndpointinClient" />
.
.
.

And then remove the config from the declaration: 然后从声明中删除配置:

        pipeFactory =
              new DuplexChannelFactory<IServiceHandler>(
                  myCallbacks);
        pipeProxy = pipeFactory.CreateChannel();

Don't worry about callbacks, they are well declared. 不用担心回调,它们已经声明好了。 But when I try to do the Create channel, it says that the endpoint is null... 但是当我尝试创建通道时,它说端点为空...

What am I missing? 我想念什么?

将Endpoint名称作为stringEndpointAddress实例传递给CreateChannel()方法调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM