Search code examples
c#wcffirewallnet.pipe

C# WCF NetPipe firewall rules


I'm running service host with net pipe on one PC and I need to connect to this host from another PC in the network. Since net pipe doesn't have any port, I cannot find out what firewall exceptions must be implemented in on the PCs / network in order for these two PC successfully communicate. The service host is created following way

            _host = new ServiceHost(_driverHandler,
       new Uri(DriversConfiguration.NetPipeUri));

        _host.AddServiceEndpoint(typeof(ISystemControl),
                                new NetNamedPipeBinding(),
                                DriversConfiguration.HostEndpoint);
        _host.Open();

Where NetPipeUri is "net.pipe://localhost" and HostEndpoint is "MyFancyApplication". Any idea what firewall exceptions and network configuration (rules on routers) should I use in order to have it working ?


Solution

  • The firewall is not the problem: netNamedPipeBinding binding provides cross-process communication on the same machine. Named pipes DO NOT WORK across machines. https://learn.microsoft.com/fr-fr/dotnet/framework/wcf/samples/netnamedpipebinding

    You have to add a NetTCPBinding to your service for remote clients