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 System.IO.Pipes.NamedPipeClientStream.Connect()
And in the debug output window:A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.Core.dll
My best googling skills couldn't find an answer for this one and I ended up trying to change the permission for the NamedPipeServerStream and venturing down the wrong path by changing the PipeAuditRule and PipeAccessRule settings.
In the end turned out my PipeDirection had to be set to InOut, even though I was only streaming information from the Server, and not receiving information.
Here's the winning line of code:
NamedPipeServerStream Pipe = new NamedPipeServerStream(PipeName, PipeDirection.InOut, 1,
PipeTransmissionMode.Message, PipeOptions.None);