Search code examples
.net.net-coremultiprocessingblazoripc

Inter-Process Communication in dotnet 5/6


I am developing a new project in Blazor WebAssembly with .NET 5, this ASP.NET Core hosted service (server part of Blazor app) will need to talk to a .NET Framework 4.7.2 Windows Service.

The communication between these two processes needs to be instant and without any bottlenecks, lag or hinder. The processes are always running on the same Windows machine.

I have been searching around online for what are the latest technologies in IPC but still find a lot of WCF and Socket related things so I am now wondering, what is the latest and/or Microsoft recommended way/technology of doing IPC between such a combination I wrote above?


Solution

  • If the communication is in the same computer, use named pipes (16% faster than TCP) or Shared Memory (a memory shared between processes on the same machine). Example: https://erikengberg.com/named-pipes-in-net-6-with-tray-icon-and-service/

    If you are talking about different machines, use NATS (https://nats.io/), ZeroMQ (https://zeromq.org/) or gRPC (https://grpc.io/).

    You can always abstract the transport and change them whenever is necessary.