views:

261

answers:

0

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="net.pipe://localhost/"
        binding="netNamedPipeBinding"
        bindingConfiguration="NoSecurityIPC"
        contract="TimeService.ITimeService" />
    </client>
    <services>
      <service name="TimeService">
        <host>
          <baseAddresses>
            <add baseAddress="net.pipe://localhost/" />
          </baseAddresses>
        </host>            
        <endpoint name="internal"
          address="net.pipe://localhost/"
          binding="netNamedPipeBinding"
          bindingConfiguration="NoSecurityIPC"
          contract="TimeService.ITimeService" />
      </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"), "");
h.Open();

ChannelFactory<ITimeService> factory = new ChannelFactory<ITimeService>("internal");

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?

EDIT: I edited above app.config to make sure both endpoints have the exact same data. That fixed my Channelfactory problem. however, the call to the service method as described above still times out.