Development

How to use .NET gRPC Client and Server with Docker

Use .NET gRPC Client and Server with Docker: I decided to write this article because I want to help others which might need something already built.

What is RPC?

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is written as if it were a normal (local) procedure call, without the programmer explicitly writing the details for the remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote.

This is a form of client–server interaction (caller is client, executor is server), typically implemented via a request–response message-passing system. In the object-oriented programming paradigm, RPCs are represented by remote method invocation (RMI).

The RPC model implies a level of location transparency, namely that calling procedures are largely the same whether they are local or remote, but usually, they are not identical, so local calls can be distinguished from remote calls. Remote calls are usually orders of magnitude slower and less reliable than local calls, so distinguishing them is important.

RPC and my first project

I created my first RPC (Remote Procedure Call) Server using C++ & Win32. The base technology was MS-DCOM and represented an Alarm and Events server for a SCADA Application.

I started working on the technical specifications and I encountered for the first time this technology. I was fascinated by it (even though it was a pain to configure all the needed windows registry keys to make it work properly 🙂 )

Several years later I discovered gRPC. I was curios on how it can be implemented with Microsoft Technologies.

.NET implementation for gRPC

I found a small tutorial on how to get started with Microsoft gRPC here: Microsoft Tutorial on gRPC. I will not go through the same steps again, please use the link I provided as reference.

I created the tutorial locally and I enhanced it to work Docker. Both client and server are deployed into Docker Containers.

The code is available on Github: https://github.com/arandi-software/dotnetGRPC

Feel free to use it as you wish in your personal or commercial projects.

If you need any help on how to use .NET gRPC Client and Server with Docker, please contact me. I will schedule a call so that we could go through the challenges you have.