Search code examples
c#named-pipes.net-standard

UnauthorizedAccessException when creating Pipes in .Net Standard


I'm trying to create a NamedPipeServerStream but when I create them I got a

UnauthorizedAccessException

And the problem is that I'm in .Net Standard so there is no constructor with PipeSecurity. Any idea of how to solve this? Do you have to add something in the UWP manifest?

I'm in .Net Standard 2.0 because the DLL are then used in a Universal App

The .Net Standard code :

namespace DataSender {
public class PipeSender {

    private NamedPipeServerStream server;
    private StreamWriter writer;

    public PipeSender(string name) {
        server = new NamedPipeServerStream(name, PipeDirection.Out);
    } ...

And the UWP code :

public sealed partial class MainPage : Page {
    public MainPage() {
        this.InitializeComponent();

        PipeSender sender = new PipeSender("testPipe");
    }
}

Solution

  • Solved, it was the firewall. Just had to disable it