Grpc.Net.ClientFactory
2.67.0
Prefix Reserved
dotnet add package Grpc.Net.ClientFactory --version 2.67.0
NuGet\Install-Package Grpc.Net.ClientFactory -Version 2.67.0
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.67.0" />
paket add Grpc.Net.ClientFactory --version 2.67.0
#r "nuget: Grpc.Net.ClientFactory, 2.67.0"
// Install Grpc.Net.ClientFactory as a Cake Addin #addin nuget:?package=Grpc.Net.ClientFactory&version=2.67.0 // Install Grpc.Net.ClientFactory as a Cake Tool #tool nuget:?package=Grpc.Net.ClientFactory&version=2.67.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);
}
}
}
}
Links
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Http (>= 6.0.0)
-
.NETStandard 2.1
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Http (>= 6.0.0)
-
net6.0
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Http (>= 6.0.0)
-
net7.0
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Http (>= 6.0.0)
-
net8.0
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Http (>= 6.0.0)
NuGet packages (209)
Showing the top 5 NuGet packages that depend on Grpc.Net.ClientFactory:
Package | Downloads |
---|---|
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core |
|
Microsoft.Azure.Functions.Worker.Grpc
This library provides gRPC support for Azure Functions .NET Worker communication with the Azure Functions Host. |
|
CouchbaseNetClient
The Official Couchbase .NET SDK. |
|
Microsoft.Azure.Functions.Worker.Extensions.Rpc
Contains types to facilitate RPC communication between a worker extension and the functions host. |
|
protobuf-net.Grpc.ClientFactory
Package Description |
GitHub repositories (35)
Showing the top 5 popular GitHub repositories that depend on Grpc.Net.ClientFactory:
Repository | Stars |
---|---|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
grpc/grpc-dotnet
gRPC for .NET
|
|
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
|
|
AlphaYu/adnc
.NET微服务/分布式开发框架,同时也适用于单体架构系统的开发。
|
|
dapr/dotnet-sdk
Dapr SDK for .NET
|
Version | Downloads | Last updated |
---|---|---|
2.67.0 | 873 | 11/21/2024 |
2.67.0-pre1 | 4,259 | 10/22/2024 |
2.66.0 | 1,084,919 | 9/20/2024 |
2.66.0-pre1 | 2,525 | 9/6/2024 |
2.65.0 | 1,968,071 | 7/27/2024 |
2.65.0-pre1 | 668 | 7/20/2024 |
2.64.0 | 189,099 | 7/19/2024 |
2.64.0-pre1 | 2,589 | 7/15/2024 |
2.63.0 | 2,242,607 | 5/24/2024 |
2.63.0-pre1 | 21,153 | 5/8/2024 |
2.62.0 | 2,191,651 | 3/29/2024 |
2.62.0-pre1 | 4,328 | 3/8/2024 |
2.61.0 | 2,260,183 | 2/22/2024 |
2.61.0-pre1 | 11,290 | 2/8/2024 |
2.60.0 | 12,715,976 | 1/3/2024 |
2.60.0-pre1 | 13,438 | 12/14/2023 |
2.59.0 | 3,463,669 | 11/8/2023 |
2.59.0-pre1 | 8,149 | 10/27/2023 |
2.58.0 | 1,097,653 | 10/19/2023 |
2.58.0-pre1 | 31,688 | 10/9/2023 |
2.57.0 | 2,684,079 | 9/6/2023 |
2.57.0-pre1 | 4,627 | 8/31/2023 |
2.56.0 | 501,241 | 8/25/2023 |
2.56.0-pre2 | 4,460 | 8/16/2023 |
2.56.0-pre1 | 15,802 | 8/3/2023 |
2.55.0 | 13,721,300 | 7/4/2023 |
2.55.0-pre1 | 5,252 | 6/23/2023 |
2.54.0 | 1,355,459 | 6/15/2023 |
2.54.0-pre1 | 11,164 | 5/25/2023 |
2.53.0 | 2,573,858 | 5/5/2023 |
2.53.0-pre1 | 15,654 | 4/12/2023 |
2.52.0 | 2,835,517 | 3/15/2023 |
2.52.0-pre1 | 8,007 | 3/3/2023 |
2.51.0 | 5,871,589 | 1/2/2023 |
2.51.0-pre1 | 7,129 | 12/7/2022 |
2.50.0 | 2,534,866 | 11/17/2022 |
2.50.0-pre1 | 22,211 | 11/3/2022 |
2.49.0 | 17,523,815 | 9/26/2022 |
2.49.0-pre1 | 3,725 | 9/1/2022 |
2.48.0 | 1,762,629 | 8/24/2022 |
2.48.0-pre1 | 2,736 | 8/17/2022 |
2.47.0 | 3,015,838 | 7/3/2022 |
2.47.0-pre1 | 3,114 | 6/23/2022 |
2.46.0 | 3,158,976 | 5/13/2022 |
2.46.0-pre1 | 7,189 | 4/28/2022 |
2.45.0 | 1,870,490 | 4/19/2022 |
2.45.0-pre1 | 12,605 | 4/7/2022 |
2.44.0 | 1,731,772 | 3/17/2022 |
2.44.0-pre1 | 19,756 | 3/9/2022 |
2.43.0 | 1,270,909 | 2/25/2022 |
2.43.0-pre1 | 10,631 | 1/28/2022 |
2.42.0 | 3,188,519 | 1/19/2022 |
2.42.0-pre1 | 9,966 | 12/30/2021 |
2.41.0 | 1,606,087 | 12/7/2021 |
2.41.0-pre1 | 20,661 | 11/12/2021 |
2.40.0 | 5,574,361 | 10/5/2021 |
2.40.0-pre1 | 4,572 | 9/9/2021 |
2.39.0 | 1,594,154 | 8/18/2021 |
2.39.0-pre1 | 5,723 | 8/6/2021 |
2.38.0 | 2,153,726 | 6/11/2021 |
2.38.0-pre1 | 1,792 | 6/4/2021 |
2.37.0 | 7,941,555 | 4/20/2021 |
2.37.0-pre1 | 1,377 | 4/14/2021 |
2.36.0 | 1,241,128 | 3/17/2021 |
2.36.0-pre1 | 1,780 | 3/9/2021 |
2.35.0 | 1,395,731 | 2/4/2021 |
2.35.0-pre1 | 2,341 | 1/26/2021 |
2.34.0 | 2,098,434 | 12/11/2020 |
2.34.0-pre1 | 3,878 | 12/1/2020 |
2.33.1 | 1,266,976 | 10/28/2020 |
2.33.1-pre1 | 1,629 | 10/22/2020 |
2.32.0 | 1,790,164 | 10/5/2020 |
2.32.0-pre1 | 14,211 | 9/8/2020 |
2.31.0 | 997,924 | 8/14/2020 |
2.31.0-pre2 | 1,791 | 8/3/2020 |
2.30.0 | 420,563 | 7/16/2020 |
2.30.0-pre1 | 4,289 | 6/17/2020 |
2.29.0 | 620,286 | 5/27/2020 |
2.29.0-pre1 | 6,163 | 5/15/2020 |
2.28.0 | 703,033 | 4/9/2020 |
2.28.0-pre2 | 17,339 | 3/11/2020 |
2.28.0-pre1 | 7,420 | 3/3/2020 |
2.27.0 | 1,610,741 | 2/7/2020 |
2.27.0-pre1 | 24,705 | 1/24/2020 |
2.26.0 | 1,540,657 | 12/19/2019 |
2.26.0-pre1 | 1,570 | 12/10/2019 |
2.25.0 | 1,031,850 | 11/7/2019 |
2.25.0-pre1 | 1,560 | 11/1/2019 |
2.24.0 | 329,380 | 10/21/2019 |
2.24.0-pre1 | 1,986 | 10/9/2019 |
2.23.2 | 665,670 | 9/20/2019 |
0.2.23-pre2 | 10,158 | 9/6/2019 |
0.2.23-pre1 | 13,288 | 8/21/2019 |
0.1.22-pre3 | 7,403 | 7/30/2019 |
0.1.22-pre2 | 12,295 | 7/2/2019 |
0.1.22-pre1 | 2,831 | 6/17/2019 |
0.1.21-pre1 | 1,935 | 6/4/2019 |