r/dotnet • u/SuitableAnteater8264 • 22h ago
Article gRPC in .NET 10: when to use it, how it works, and why it fits internal service communication
zocate.liWhen I designed a control flow between an API and agents in my homelab/prod setup, it became obvious that loose HTTP calls didn’t model the problem well. I needed a persistent, typed, bidirectional channel — and that’s where gRPC in .NET 10 came into the picture.
What gRPC solves best
- Strong contract between services — client and server agree on method names, input/output types, and message shape through
.protofiles. - Continuous communication — instead of multiple independent requests, you can keep a stream open for heartbeats, inventory updates, and even an interactive terminal.
- More natural for internal scenarios — it makes more sense when the services are under the same team’s control and share contract versions.
Where it fits in the architecture
In the Dokpod case, the split looked like this:
| Channel | Technology | Use |
|---|---|---|
| Web interface | REST/OpenAPI | UI operations |
| Notifications | SignalR | Real-time events |
| Internal channel | gRPC | API ↔ agents |
- Outbound connection initiated by the agent — this helps in scenarios where the host sits behind NAT or a firewall.
- Client certificate authentication — adds identity to the channel between the API and agents.
- HTTP/2 as the base — the transport fits the model of multiple messages over a single connection much better.
When I would choose gRPC
- When both ends are controlled by the same team.
- When you want typed messages and code generation.
- When bidirectional streaming is central to the problem.
- When the communication is more “service-to-service” than “human client to API”.
When I would avoid it
- When the consumption needs to be open and simple for third parties.
- When REST already solves the use case well.
- When the team wants an easier surface to inspect manually.
In the end, gRPC is not a universal replacement for REST; it’s a very specific tool for very specific problems. In my case, it fit because there was a real need for persistent streaming, strong contracts, and internal communication between components. How are you using gRPC in .NET — only for internal service calls, or have you pushed it closer to the edge as well?