Problems connecting to WCF Service via NetNamedPipeBinding

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-26T10:08:25Z Indexed on 2010/05/26 10:11 UTC
Read the original article Hit count: 792

I'm having trouble figuring out how to get a named pipe WCF service to work. The service is in a seperate assembly from the executable.

The config looks like this:

  <system.serviceModel>
    <bindings>
      <netNamedPipeBinding>
        <binding name="NoSecurityIPC">
          <security mode="None" />
        </binding>
      </netNamedPipeBinding>
    </bindings>
    <client>
      <endpoint name="internal"
                address="channel1"
                binding="netNamedPipeBinding"
                bindingConfiguration="NoSecurityIPC"
                contract="conplement.TimeService.ICpTimeService" />
    </client>
    <services>
      <service name="cpTimeService">
        <host>
          <baseAddresses>
            <add baseAddress="net.pipe://localhost/" />
          </baseAddresses>
        </host>
        <endpoint
            address="channel1"
            binding="netNamedPipeBinding"
            bindingConfiguration="NoSecurityIPC"
            contract="conplement.TimeService.ICpTimeService" />
      </service>
    </services>
  </system.serviceModel>

I'm using a ChannelFactory to create a proxy to access the service host:

ServiceHost h = new ServiceHost(typeof(TimeService), new Uri("net.pipe://localhost/"));
h.AddServiceEndpoint(typeof(ITimeService), new NetNamedPipeBinding("NoSecurityIPC"), "net.pipe://localhost/");
h.Open();

ChannelFactory<ITimeService> factory = new ChannelFactory<ITimeService>("channel1", new EndpointAddress(new Uri("net.pipe://localhost/")));

ICpTimeService proxy = factory.CreateChannel();

using (proxy as IDisposable)
{                
    this.ds = proxy.LoadData();
}

I'm not sure what I'm doing wrong when I create the ChannelFactory. It can't seem to find the "channel1" in the config. When I create my binding manually and pass it to the ChannelFactory constructor, the factory and the proxy are created but the call to the LoadData() fails (times out).

Can anyone see what I'm doing wrong here?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET