0

I'm building an program for a service that uses WCF over net named pipes.

The protocol was off by default in my machine, so I'd like to turn it on programatically.

There doesn't seem to be much information available besides a powershell script (also here) and a registry key solution that is also fairly vague.

Can someone provide more clarity on this? Specifically, how to turn on "Named Pipe Activation", as in the screenshot below, via C# code. Thanks!

enter image description here

Ben
  • 54,723
  • 49
  • 178
  • 224
  • 1
    Neither of your two links have anything to do with Named Pipe Activation, those are for enabling named pips on SQL Server. Also, the way to turn it on during the install depends on the installer software you are using, please edit your question and include details about what installer software you are using. – Scott Chamberlain Mar 22 '18 at 16:33
  • That's probably why I'm confused, there seem to be many keywords used interchangeably. Edited to remove the word "installer", let's just say I have a program that I want to run to do whatever that checkbox does, but programatically. – Ben Mar 22 '18 at 16:34
  • https://stackoverflow.com/questions/8054282/how-can-you-programmatically-turn-off-or-on-windows-features – DavidG Mar 22 '18 at 16:35
  • @DavidG looks promising! Thank you, investigating. – Ben Mar 22 '18 at 16:36
  • Are you hosting your WCF app in IIS or as a windows service? Turning on Named Pipe Activation is only required for using named pipes while hosting in IIS. Windows services should work fine with named pipes without it. – Scott Chamberlain Mar 22 '18 at 16:36
  • Not knowingly using IIS. I'm using `System.ServiceModel` and a duplex contract with `ServiceBehavior`s and `OperationContract`s. Next step is to get it running as a Windows service. My code didn't work until I had turned on that feature. The WCF service endpoint is of the form `net.pipe://localhost/myEndpoint`. – Ben Mar 22 '18 at 16:40
  • @DavidG I've posted my solution thanks to your link. If you wanted to post a solution I'll accept that one (and probably delete mine). Cheers! Thanks for the help everyone. – Ben Mar 22 '18 at 16:56
  • 1
    Since it's a duplicate, I've closed it as such. Glad you have your answer :) – DavidG Mar 22 '18 at 16:57

1 Answers1

1

The keywords that I was looking for were "turning Windows features on and off", not named pipes specifically.

This post describes how to do this (thanks @davidg).

I filtered the available features with

dism /online /get-features | find "Pipe"

...which let me build the command outlined here:

dism /online /enable-feature:WCF-Pipe-Activation45 /norestart
Ben
  • 54,723
  • 49
  • 178
  • 224