1

The reason I'm writing this question is that I seem to be getting the following error when I'm trying to communicate between a windows service and a WPF app via a WCF service with a NetNamedPipe binding:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://localhost/Pipe_SendInfo


Now the gory details.

Ok, I have a windows service that is periodically executing code, I wanted to let a user know what is happening inside the service. So I read that I could accomplish this via NetNamedPipe WCF service. I created two test apps and successfully was able to send a message from one process to another. I then attempted to send messages from the windows service to a client app(on the same machine) and have so far failed miserably :(.

My windows service essentially does this(trying to send info):

ChannelFactory<SkipSyncLib.ISendInfo> pipeFactory =
    new ChannelFactory<SkipSyncLib.ISendInfo>(
        new NetNamedPipeBinding(),
        new EndpointAddress("net.pipe://localhost/Pipe_SendInfo"));

pipeFactory.CreateChannel();
pipeFactory.SendInfo(info);

and the application that is supposed to receive the information does this when it starts up:

public void Start()
{
    HostService = new ServiceHost(this, new Uri[] { new Uri("net.pipe://localhost") });
    HostService.AddServiceEndpoint(typeof(ISendInfo), new NetNamedPipeBinding(), "Pipe_SendInfo");

    try
    {
        HostService.Open();
    }
    catch (Exception exc)
    {
        //Error handling
    }
}

The kicker is that while the windows service is failing miserably to find the endpoint I have another console app that is able to send info to the running client app successfully. So logic would tell me that it probably has something to do with users. But I can't figure it out.

Any ideas? Should I just drop named pipes and go with an http binding?

I just found out about named pipes earlier today so please be gentle if the answer is obvious.

Thanks

Jose
  • 10,891
  • 19
  • 67
  • 89
  • What OS are you running? If Windows Vista or greater, have a look here: http://stackoverflow.com/questions/7477813/getting-endpointnotfoundexception-with-netnamedpipebinding-in-c-need-to-create. – Matt Davis Mar 14 '12 at 04:13
  • Server 2008. I found a way to make it work. The client app and the windows service needed to be run as the same user so that the named pipe would be available. – Jose Mar 14 '12 at 15:01

2 Answers2

0

Should you use the same endpoint address?

HostService = new ServiceHost(this, new Uri[] { new Uri("net.pipe://localhost/Pipe_SendInfo") });

add /Pipe_SendInfo in Uri

marvinc
  • 51
  • 7
0

I figured out a way for it to work. There's probably a more elegant way to do this, but if the windows service and the client app are run as the same user then the communication channel works.

Jose
  • 10,891
  • 19
  • 67
  • 89