gRPC is a good fit for applications that need fast communication between services. It uses HTTP/2, strongly typed contracts, and efficient binary serialization, which makes it useful for internal APIs, service-to-service communication, and applications where request overhead matters.
Putting a gRPC service behind Azure Front Door adds another layer to the architecture. Azure Front Door can provide a public entry point, TLS termination, routing, health checks, WAF protection, and traffic management, but gRPC introduces requirements that need to be checked before the service is placed behind it.
A setup that works perfectly for a normal REST API may not work the same way for gRPC.
This article explains the important pieces involved in running an ASP.NET Core gRPC service through Azure Front Door, including HTTP/2 requirements, TLS, backend configuration, health probes, routing, and common problems that can appear during deployment.
A Typical Architecture
A basic architecture looks like this:
Client
|
| HTTPS
v
Azure Front Door
|
| HTTPS / HTTP
v
ASP.NET Core gRPC Service
|
v
Application DependenciesThe client connects to Azure Front Door instead of directly connecting to the application.
Azure Front Door then forwards the request to the backend service.
For a gRPC application, the important part is that the connection between the client and the service depends on HTTP/2.
A REST API can usually operate comfortably over HTTP/1.1. A gRPC service cannot be treated as an ordinary HTTP/1.1 API.
Why gRPC Needs HTTP/2
gRPC is built around HTTP/2.
HTTP/2 provides features that gRPC relies on, including:
Binary framing
Multiplexed streams
Header compression
Long-lived connections
Efficient request and response handling
A normal REST request might look conceptually like this:
HTTP request
|
v
JSON body
|
v
HTTP responseA gRPC request uses a different communication model:
HTTP/2 connection
|
+--- Stream 1
+--- Stream 2
+--- Stream 3
+--- Stream 4Multiple streams can share the same HTTP/2 connection.
This is one reason gRPC is useful for service-to-service communication.
Because of this architecture, every component in the request path needs to support the required gRPC traffic correctly.
Create a Simple ASP.NET Core gRPC Service
An ASP.NET Core application can expose a gRPC service using a protobuf contract.
For example, the contract can be defined as:
syntax = "proto3";
option csharp_namespace = "GrpcService";
package orders;
service OrderService {
rpc GetOrder (GetOrderRequest) returns (OrderResponse);
}
message GetOrderRequest {
int32 orderId = 1;
}
message OrderResponse {
int32 orderId = 1;
string status = 2;
}The generated C# base class can then be implemented by the service.
public class OrderService : OrderService.OrderServiceBase
{
public override Task<OrderResponse> GetOrder(
GetOrderRequest request,
ServerCallContext context)
{
return Task.FromResult(new OrderResponse
{
OrderId = request.OrderId,
Status = "Processed"
});
}
}The service can be registered in the ASP.NET Core application:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpc();
var app = builder.Build();
app.MapGrpcService<OrderService>();
app.Run();The application now exposes the gRPC endpoint.
Configure HTTP/2
The application needs to accept HTTP/2 traffic.
For Kestrel, an explicit configuration can look like this:
builder.WebHost.ConfigureKestrel(options =>
{
options.ListenAnyIP(5001, listenOptions =>
{
listenOptions.UseHttps();
listenOptions.Protocols = HttpProtocols.Http2;
});
});The exact hosting configuration depends on how the application is deployed.
For local development, ASP.NET Core tooling often provides HTTP/2 support through the generated development certificate and launch configuration.
In production, TLS and HTTP/2 configuration need to be verified together.
TLS Matters for gRPC
Production gRPC traffic normally runs over HTTP/2 with TLS.
That means the client connection generally looks like:
Client
|
| HTTPS + HTTP/2
v
Azure Front Door
|
| HTTPS + HTTP/2
v
gRPC BackendThere are therefore two connections to think about.
The first is the connection between the client and Azure Front Door.
The second is the connection between Azure Front Door and the backend.
A configuration can have a healthy client-facing HTTPS connection while the backend connection is incorrectly configured.
That is why testing only the public URL is not enough.
Configure the Front Door Origin
The backend needs to be added to the Azure Front Door configuration as an origin.
Depending on the architecture, the origin might be:
Azure App Service
Azure Container Apps
Azure Kubernetes Service
A public application endpoint
Another supported backend
The important part is that the origin must be reachable by Azure Front Door and configured for the protocol expected by the gRPC application.
For example, if the application is exposed through HTTPS on the backend, the origin should point to the correct hostname.
The backend certificate also needs to be valid for the hostname used by the connection.
Configure the Front Door Route
The Front Door route determines how incoming requests are forwarded.
A simple route might look conceptually like this:
https://api.example.com/*
|
v
Front Door Route
|
v
gRPC Origin Group
|
v
ASP.NET Core gRPCThe route needs to match the public hostname and path used by the client.
Unlike a REST API where developers often expose paths such as:
/api/orders
/api/customers
/api/productsgRPC requests use service and method paths generated from the gRPC service definition.
For example, a method may be addressed internally through a path similar to:
/orders.OrderService/GetOrderThe application and Front Door routing rules must therefore be compatible with the actual gRPC request path.
Do Not Rewrite gRPC Paths Accidentally
This is an easy mistake to make when adapting an existing REST-oriented Front Door configuration.
Suppose a REST route uses:
/api/*and rewrites the path before forwarding it to the backend.
That may be appropriate for a REST API.
A gRPC request contains a service and method path that the gRPC server expects.
Changing that path can prevent ASP.NET Core from finding the correct gRPC method.
For gRPC routes, keep path transformations simple unless there is a specific reason to rewrite them.
HTTP/2 Between Front Door and the Backend
Supporting HTTP/2 from the client to Front Door does not automatically mean the backend connection is configured correctly.
You need to verify the complete request path:
Client
|
| HTTP/2
v
Azure Front Door
|
| Backend protocol
v
ASP.NET CoreIf the backend is configured for a protocol that does not support the required gRPC traffic, requests may fail even though the Front Door endpoint itself is available.
This is one of the first things to check when a gRPC service works directly but fails through Front Door.
Test the Backend Directly First
Before troubleshooting Azure Front Door, test the gRPC service directly.
This separates application problems from networking and routing problems.
A useful test sequence is:
1. Test ASP.NET Core gRPC locally
2. Test deployed gRPC backend directly
3. Test backend through Front Door
4. Test from the real clientIf the service fails at step two, Front Door is not the problem.
If it works at step two but fails at step three, focus on Front Door configuration.
This simple separation can save a significant amount of debugging time.
Use grpcurl for Testing
grpcurl is useful for testing gRPC services from the command line.
For example:
grpcurl \
-insecure \
grpc.example.com:443 \
listFor a service that exposes reflection, this can list available services.
You can then inspect a service:
grpcurl \
-insecure \
grpc.example.com:443 \
describe orders.OrderServiceAnd invoke a method:
grpcurl \
-insecure \
-d '{"orderId":1001}' \
grpc.example.com:443 \
orders.OrderService/GetOrderFor production certificate validation, do not use insecure mode.
The purpose here is to verify the protocol and service independently from the application's client code.
gRPC Reflection and Production
gRPC reflection can make testing easier because tools such as grpcurl can discover service definitions.
However, reflection is not automatically required for a production gRPC client.
A normal client already knows the protobuf contract.
If reflection is enabled, treat it as another exposed service capability and consider whether it should be available publicly.
A production API may choose to expose reflection only in controlled environments.
Health Checks Need Attention
Azure Front Door uses health checks to determine whether an origin is healthy.
A normal HTTP health endpoint might look like:
/healthBut a gRPC service does not necessarily expose a normal REST-style health endpoint.
If Front Door is configured to probe an endpoint that the gRPC application does not understand, the origin can be marked unhealthy.
One option is to expose a suitable health endpoint alongside the gRPC service.
For example:
app.MapGet("/health", () => Results.Ok("Healthy"));
app.MapGrpcService<OrderService>();
Join the conversation! Your thoughts help the community grow.