Grpc.Net.ClientFactory 2.49.0

.NET 5.0 .NET Standard 2.0
NuGet\Install-Package Grpc.Net.ClientFactory -Version 2.49.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package Grpc.Net.ClientFactory --version 2.49.0
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.49.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Grpc.Net.ClientFactory --version 2.49.0
#r "nuget: Grpc.Net.ClientFactory, 2.49.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Grpc.Net.ClientFactory as a Cake Addin
#addin nuget:?package=Grpc.Net.ClientFactory&version=2.49.0

// Install Grpc.Net.ClientFactory as a Cake Tool
#tool nuget:?package=Grpc.Net.ClientFactory&version=2.49.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);
            }
        }
    }
}
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (82)

Showing the top 5 NuGet packages that depend on Grpc.Net.ClientFactory:

Package Downloads
Grpc.AspNetCore.Server.ClientFactory The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core

Microsoft.Azure.Functions.Worker.Grpc The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

This library provides gRPC support for Azure Functions .NET Worker communication with the Azure Functions Host.

protobuf-net.Grpc.ClientFactory The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

Sitko.Core.Grpc.Client

Sitko.Core is a set of libraries to help build .NET Core applications fast

devprime.stack.services

DevPrime Service

GitHub repositories (21)

Showing the top 5 popular GitHub repositories that depend on Grpc.Net.ClientFactory:

Repository Stars
dotnet-architecture/eShopOnContainers
Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 6, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor.
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
grpc/grpc-dotnet
gRPC for .NET
dapr/dotnet-sdk
Dapr SDK for .NET
AlphaYu/Adnc
.NET6微服务/分布式开发框架,同时也适用于单体架构系统的开发。
Version Downloads Last updated
2.49.0 19,307 9/26/2022
2.49.0-pre1 1,057 9/1/2022
2.48.0 224,180 8/24/2022
2.48.0-pre1 1,431 8/17/2022
2.47.0 467,657 7/3/2022
2.47.0-pre1 1,575 6/23/2022
2.46.0 938,564 5/13/2022
2.46.0-pre1 2,488 4/28/2022
2.45.0 595,522 4/19/2022
2.45.0-pre1 4,131 4/7/2022
2.44.0 630,518 3/17/2022
2.44.0-pre1 10,224 3/9/2022
2.43.0 437,681 2/25/2022
2.43.0-pre1 7,486 1/28/2022
2.42.0 1,080,977 1/19/2022
2.42.0-pre1 6,456 12/30/2021
2.41.0 899,636 12/7/2021
2.41.0-pre1 16,412 11/12/2021
2.40.0 1,823,811 10/5/2021
2.40.0-pre1 3,522 9/9/2021
2.39.0 883,766 8/18/2021
2.39.0-pre1 4,463 8/6/2021
2.38.0 1,495,833 6/11/2021
2.38.0-pre1 807 6/4/2021
2.37.0 3,810,092 4/20/2021
2.37.0-pre1 432 4/14/2021
2.36.0 800,462 3/17/2021
2.36.0-pre1 916 3/9/2021
2.35.0 1,074,993 2/4/2021
2.35.0-pre1 1,351 1/26/2021
2.34.0 1,596,143 12/11/2020
2.34.0-pre1 2,805 12/1/2020
2.33.1 965,970 10/28/2020
2.33.1-pre1 728 10/22/2020
2.32.0 1,033,107 10/5/2020
2.32.0-pre1 13,221 9/8/2020
2.31.0 732,193 8/14/2020
2.31.0-pre2 815 8/3/2020
2.30.0 317,008 7/16/2020
2.30.0-pre1 3,264 6/17/2020
2.29.0 484,852 5/27/2020
2.29.0-pre1 3,900 5/15/2020
2.28.0 496,120 4/9/2020
2.28.0-pre2 16,397 3/11/2020
2.28.0-pre1 6,148 3/3/2020
2.27.0 1,311,410 2/7/2020
2.27.0-pre1 23,118 1/24/2020
2.26.0 1,506,895 12/19/2019
2.26.0-pre1 711 12/10/2019
2.25.0 1,011,732 11/7/2019
2.25.0-pre1 640 11/1/2019
2.24.0 270,788 10/21/2019
2.24.0-pre1 1,045 10/9/2019
2.23.2 437,124 9/20/2019
0.2.23-pre2 9,085 9/6/2019
0.2.23-pre1 9,248 8/21/2019
0.1.22-pre3 6,235 7/30/2019
0.1.22-pre2 10,737 7/2/2019
0.1.22-pre1 1,965 6/17/2019
0.1.21-pre1 1,096 6/4/2019