I have a service running under the Network Service account. The service just sets up a named pipe and listens for connections:
NamedPipeServerStream listenin
Pipe server is created with the default service DACL so that only the administrator or system user can connect to the pipe. You need to set the pipe server with proper access rules to make all client connection to succeed. Below is the code to set the access rule to access everyone to access the pipe:
PipeSecurity pipeSa = new PipeSecurity();
pipeSa.SetAccessRule(new PipeAccessRule("Everyone",
PipeAccessRights.ReadWrite, AccessControlType.Allow));
listeningPipe.SetAccessControl(pipeSa);
It always better to define only a minimal set of users to access the pipe server to make it secure.
I'm not allowed to comment, but I want to point out that dvansanth's answer is correct depending on the OS language. When the OS language isn't English, the "Everyone" group probably won't exist.
I've solved it like this:
PipeSecurity pipeSa = new PipeSecurity();
pipeSa.SetAccessRule(new PipeAccessRule(new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null),
PipeAccessRights.ReadWrite, AccessControlType.Allow));
listeningPipe.SetAccessControl(pipeSa);
Note this is for "Authenticated users" not "Everyone"