没有端点监听

时间:2013-02-04 13:47:10

标签: c# .net wcf

当我尝试在WCF主机中调用该方法时,我收到此错误:

  

net.pipe:// localhost / PipeReverse没有监听端点   那可以接受这个消息。这通常是由不正确引起的   地址或SOAP操作。有关更多信息,请参阅InnerException(如果存在)   的信息。

我有一个启动WCF主机的类:

public class ProcessUnderMouseServer
{
    public ProcessUnderMouseServer()
    {
        using (host = new ServiceHost(
            typeof(PrcoessUnderMouse),
            new Uri[]
            {
                new Uri("net.pipe://localhost")
            }))
        {  
                host.AddServiceEndpoint(
                    typeof(IPrcoessUnderMouse),
                    new NetNamedPipeBinding(),
                    "PipeReverse");

                host.Open();
        }
    }
}

此类与消费项目

位于不同的库项目中

然后我尝试像这样消费它:

ProcessUnderMouseServer ProcessUnderMouseServer = new ProcessUnderMouseServer();

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

            IPrcoessUnderMouse pipeProxy = pipeFactory.CreateChannel();
            string str = Console.ReadLine();

            Console.WriteLine("pipe: " + pipeProxy.GetProcessUnderMouse());

不应该

host.AddServiceEndpoint(typeof(IPrcoessUnderMouse),new NetNamedPipeBinding(), "PipeReverse");

足以添加终点?为什么它说no endpoint listening at net.pipe://localhost/PipeReverse ??

0 个答案:

没有答案