Grpc.Net.ClientFactory 2.76.0

Grpc.Net.ClientFactory

gRPC integration with HttpClientFactory offers a centralized way to create gRPC clients. It can be used as an alternative to configuring stand-alone gRPC client instances.

The factory offers the following benefits:

  • Provides a central location for configuring logical gRPC client instances
  • Manages the lifetime of the underlying HttpClientMessageHandler
  • Automatic propagation of deadline and cancellation in an ASP.NET Core gRPC service

Register gRPC clients

To register a gRPC client, the generic AddGrpcClient extension method can be used within Startup.ConfigureServices, specifying the gRPC typed client class and service address:

services.AddGrpcClient<Greeter.GreeterClient>(o =>
{
    o.Address = new Uri("https://localhost:5001");
});

The gRPC client type is registered as transient with dependency injection (DI). The client can now be injected and consumed directly in types created by DI. ASP.NET Core MVC controllers, SignalR hubs and gRPC services are places where gRPC clients can automatically be injected:

public class AggregatorService : Aggregator.AggregatorBase
{
    private readonly Greeter.GreeterClient _client;

    public AggregatorService(Greeter.GreeterClient client)
    {
        _client = client;
    }

    public override async Task SayHellos(HelloRequest request,
        IServerStreamWriter<HelloReply> responseStream, ServerCallContext context)
    {
        // Forward the call on to the greeter service
        using (var call = _client.SayHellos(request))
        {
            await foreach (var response in call.ResponseStream.ReadAllAsync())
            {
                await responseStream.WriteAsync(response);
            }
        }
    }
}

Showing the top 20 packages that depend on Grpc.Net.ClientFactory.

Packages Downloads
Aspire.Hosting.MongoDB
MongoDB support for Aspire.
8
Aspire.Hosting.PostgreSQL
PostgreSQL® support for Aspire.
7
Aspire.Hosting.Nats
NATS support for Aspire.
6
Aspire.Hosting.SqlServer
Microsoft SQL Server support for Aspire.
6
Aspire.Hosting
Core abstractions for the Aspire application model.
6
Aspire.Hosting.AppHost
Core library and MSBuild logic for Aspire AppHost projects.
5
Aspire.Hosting.Nats
NATS support for Aspire.
5
Aspire.Hosting
Core abstractions for the Aspire application model.
4
Aspire.Hosting.SqlServer
Microsoft SQL Server support for .NET Aspire.
4
Aspire.Hosting.MongoDB
MongoDB support for Aspire.
4
Aspire.Hosting.Nats
NATS support for .NET Aspire.
3
Aspire.Hosting.SqlServer
Microsoft SQL Server support for Aspire.
3
Aspire.Hosting.SqlServer
Microsoft SQL Server support for .NET Aspire.
3
Aspire.Hosting
Core abstractions for the .NET Aspire application model.
3
Aspire.Hosting.Nats
NATS support for Aspire.
3

.NET 8.0

.NET 9.0

.NET 10.0

.NET Standard 2.0

.NET Standard 2.1

Version Downloads Last updated
2.76.0 1 12/19/2025
2.76.0-pre1 1 12/19/2025
2.71.0 1 12/19/2025
2.71.0-pre1 1 12/11/2025
2.70.0 0 03/10/2025
2.70.0-pre1 1 12/12/2025
2.67.0 1 12/14/2025
2.67.0-pre1 1 12/11/2025
2.66.0 1 12/15/2025
2.66.0-pre1 2 12/11/2025
2.65.0 1 12/13/2025
2.65.0-pre1 1 12/11/2025
2.64.0 2 12/11/2025
2.64.0-pre1 0 12/12/2025
2.63.0 2 12/11/2025
2.63.0-pre1 1 12/11/2025
2.62.0 1 12/19/2025
2.62.0-pre1 0 12/12/2025
2.61.0 2 12/12/2025
2.61.0-pre1 1 12/11/2025
2.60.0 2 12/11/2025
2.60.0-pre1 1 12/11/2025
2.59.0 2 12/11/2025
2.59.0-pre1 1 12/11/2025
2.58.0 1 12/19/2025
2.58.0-pre1 1 12/11/2025
2.57.0 2 12/11/2025
2.57.0-pre1 1 12/13/2025
2.56.0 2 12/11/2025
2.56.0-pre2 0 08/16/2023
2.56.0-pre1 0 12/12/2025
2.55.0 1 12/14/2025
2.55.0-pre1 1 12/11/2025
2.54.0 0 06/15/2023
2.54.0-pre1 1 12/10/2025
2.53.0 2 12/11/2025
2.53.0-pre1 1 12/11/2025
2.52.0 2 12/11/2025
2.52.0-pre1 0 12/11/2025
2.51.0 2 12/11/2025
2.51.0-pre1 0 12/07/2022
2.50.0 2 12/11/2025
2.50.0-pre1 1 12/11/2025
2.49.0 3 12/11/2025
2.49.0-pre1 1 12/11/2025
2.48.0 2 12/11/2025
2.48.0-pre1 1 12/11/2025
2.47.0 2 12/11/2025
2.47.0-pre1 1 12/11/2025
2.46.0 1 12/19/2025
2.46.0-pre1 1 12/11/2025
2.45.0 2 12/10/2025
2.45.0-pre1 1 12/11/2025
2.44.0 2 12/11/2025
2.44.0-pre1 1 12/11/2025
2.43.0 2 12/14/2025
2.43.0-pre1 0 12/11/2025
2.42.0 2 12/11/2025
2.42.0-pre1 1 12/11/2025
2.41.0 1 12/19/2025
2.41.0-pre1 0 12/10/2025
2.40.0 1 12/10/2025
2.40.0-pre1 0 12/15/2025
2.39.0 2 12/11/2025
2.39.0-pre1 0 12/14/2025
2.38.0 2 12/15/2025
2.38.0-pre1 2 12/11/2025
2.37.0 3 12/11/2025
2.37.0-pre1 0 04/14/2021
2.36.0 1 12/11/2025
2.36.0-pre1 1 12/11/2025
2.35.0 1 12/19/2025
2.35.0-pre1 0 12/10/2025
2.34.0 1 12/11/2025
2.34.0-pre1 0 12/01/2020
2.33.1 1 12/19/2025
2.33.1-pre1 1 12/11/2025
2.32.0 1 12/10/2025
2.32.0-pre1 0 12/12/2025
2.31.0 1 12/11/2025
2.31.0-pre2 1 12/09/2025
2.30.0 2 12/12/2025
2.30.0-pre1 0 06/17/2020
2.29.0 2 12/11/2025
2.29.0-pre1 0 05/15/2020
2.28.0 1 12/19/2025
2.28.0-pre2 1 12/11/2025
2.28.0-pre1 0 03/03/2020
2.27.0 1 12/19/2025
2.27.0-pre1 0 01/24/2020
2.26.0 2 12/11/2025
2.26.0-pre1 0 12/10/2019
2.25.0 1 12/16/2025
2.25.0-pre1 0 11/01/2019
2.24.0 1 12/19/2025
2.24.0-pre1 0 10/09/2019
2.23.2 2 12/11/2025
0.2.23-pre2 2 12/11/2025
0.2.23-pre1 2 12/11/2025
0.1.22-pre3 1 12/11/2025
0.1.22-pre2 0 07/02/2019
0.1.22-pre1 3 12/11/2025
0.1.21-pre1 1 12/11/2025