named-pipe-wrapper icon indicating copy to clipboard operation
named-pipe-wrapper copied to clipboard

System.UnauthorizedAccessException: Access to the path is denied.

Open dwilches opened this issue 7 years ago • 1 comments

Hello,

I'm using version 1.5.0 downloaded from NuGet's repositories and when trying the code you have in the README.md I got this exception:

System.UnauthorizedAccessException: Access to the path is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at NamedPipeWrapper.NamedPipeClient`2.ListenSync()
   at NamedPipeWrapper.Threading.Worker.DoWorkImpl(Object oAction)

I see you added some configuration for security after 1.5.0 but while you release the final version of 1.5.3, is there a sample of code that works with 1.5.0?

The sample project you have in the repo is using version 1.4.0's DLL instead, but the code of the NamedPipeWrapper project seems to be for 1.5.3-Beta.

In case it's important, my use case is: I create the server pipe in a Windows' service and the client in a GUI app.

Also, where can I find the exact source code that you released in NuGet as 1.5.0 ? I didn't find version tags in this repo.

Thanks.

dwilches avatar May 19 '17 22:05 dwilches

Here is how to fix:

        PipeSecurity pSecure = new PipeSecurity();
        pSecure.SetAccessRule(new PipeAccessRule("Everyone", PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow));

        pipeServer = new NamedPipeServer<YOUR_CLASS>("Your.PipeName", pSecure);

evelo2 avatar Nov 19 '18 22:11 evelo2