小编bla*_*e33的帖子

命名管道的 WCF 错误“无端点侦听”

我在 .NET 3.5 中使用 WCF 我正在使用命名管道但不断收到错误

在 net.pipe://localhost/Test 上没有侦听端点可以接受消息。这通常是由不正确的地址或 SOAP 操作引起的。

我按照教程http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication但问题仍然存在。客户端和服务器上的端点是相同的(我检查了拼写等)。此项目没有配置文件,但配置在代码中。

编辑:代码(客户端):

  ChannelFactory<ITest> pipeFactory =
    new ChannelFactory<ITest>(
    new NetNamedPipeBinding(),
    new EndpointAddress(
    "net.pipe://localhost/test"));

       ITest test= pipeFactory.CreateChannel();

            test.doStuff();
Run Code Online (Sandbox Code Playgroud)

服务器:

        serviceHost = new ServiceHost(typeof(Test), new Uri("net.pipe://localhost"));

        serviceHost.AddServiceEndpoint(typeof(ITest), new NetNamedPipeBinding(), "test");

        File.Create(@"C:\test.txt");

        serviceHost.Open();
Run Code Online (Sandbox Code Playgroud)

谢谢

c# wcf

3
推荐指数
1
解决办法
4316
查看次数

标签 统计

c# ×1

wcf ×1