Grpc.Net.ClientFactory 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
Showing the top 20 packages that depend on Grpc.Net.ClientFactory.
Packages | Downloads |
---|---|
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
628 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
390 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
311 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
172 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
120 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
93 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
78 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
60 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
58 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
39 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
26 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
23 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
22 |
Grpc.AspNetCore.Server.ClientFactory
HttpClientFactory integration the for gRPC .NET client when running in ASP.NET Core
|
21 |
.NET 6.0
- Grpc.Net.Client (>= 2.67.0)
- Microsoft.Extensions.Http (>= 6.0.0)
.NET Standard 2.1
- Microsoft.Extensions.Http (>= 6.0.0)
- Grpc.Net.Client (>= 2.67.0)
.NET Standard 2.0
- Microsoft.Extensions.Http (>= 6.0.0)
- Grpc.Net.Client (>= 2.67.0)
.NET 8.0
- Microsoft.Extensions.Http (>= 6.0.0)
- Grpc.Net.Client (>= 2.67.0)
.NET 7.0
- Microsoft.Extensions.Http (>= 6.0.0)
- Grpc.Net.Client (>= 2.67.0)
Version | Downloads | Last updated |
---|---|---|
2.67.0 | 6 | 11/29/2024 |
2.67.0-pre1 | 8 | 10/22/2024 |
2.66.0 | 13 | 09/23/2024 |
2.66.0-pre1 | 8 | 09/09/2024 |
2.65.0 | 10 | 08/01/2024 |
2.65.0-pre1 | 12 | 07/26/2024 |
2.64.0 | 11 | 07/26/2024 |
2.64.0-pre1 | 11 | 07/26/2024 |
2.63.0 | 12 | 05/29/2024 |
2.63.0-pre1 | 12 | 05/23/2024 |
2.62.0 | 13 | 04/01/2024 |
2.62.0-pre1 | 14 | 03/09/2024 |
2.61.0 | 14 | 02/28/2024 |
2.61.0-pre1 | 13 | 03/01/2024 |
2.60.0 | 240 | 01/30/2024 |
2.60.0-pre1 | 13 | 01/08/2024 |
2.59.0 | 168 | 11/15/2023 |
2.59.0-pre1 | 13 | 01/10/2024 |
2.58.0 | 11 | 03/03/2024 |
2.58.0-pre1 | 17 | 10/11/2023 |
2.57.0 | 10 | 11/30/2023 |
2.57.0-pre1 | 14 | 12/05/2023 |
2.56.0 | 15 | 10/21/2023 |
2.56.0-pre2 | 35 | 08/25/2023 |
2.56.0-pre1 | 12 | 10/12/2023 |
2.55.0 | 18 | 09/22/2023 |
2.55.0-pre1 | 16 | 07/01/2023 |
2.54.0 | 22 | 11/23/2023 |
2.54.0-pre1 | 17 | 12/01/2023 |
2.53.0 | 16 | 11/29/2023 |
2.53.0-pre1 | 14 | 08/15/2023 |
2.52.0 | 22 | 09/14/2023 |
2.52.0-pre1 | 9 | 03/08/2024 |
2.51.0 | 15 | 10/06/2023 |
2.51.0-pre1 | 13 | 07/01/2023 |
2.50.0 | 526 | 12/14/2022 |
2.50.0-pre1 | 14 | 12/18/2023 |
2.49.0 | 470 | 12/14/2022 |
2.49.0-pre1 | 13 | 10/09/2023 |
2.48.0 | 16 | 06/04/2023 |
2.48.0-pre1 | 12 | 06/05/2023 |
2.47.0 | 12 | 12/26/2023 |
2.47.0-pre1 | 16 | 08/16/2023 |
2.46.0 | 378 | 07/09/2022 |
2.46.0-pre1 | 12 | 07/01/2023 |
2.45.0 | 20 | 10/01/2023 |
2.45.0-pre1 | 13 | 10/09/2023 |
2.44.0 | 16 | 11/07/2023 |
2.44.0-pre1 | 14 | 06/04/2023 |
2.43.0 | 16 | 06/06/2023 |
2.43.0-pre1 | 13 | 06/04/2023 |
2.42.0 | 14 | 12/18/2023 |
2.42.0-pre1 | 18 | 07/01/2023 |
2.41.0 | 19 | 06/15/2023 |
2.41.0-pre1 | 15 | 12/30/2023 |
2.40.0 | 977 | 11/12/2021 |
2.40.0-pre1 | 12 | 01/18/2024 |
2.39.0 | 60 | 09/16/2021 |
2.39.0-pre1 | 14 | 09/14/2023 |
2.38.0 | 97 | 07/16/2021 |
2.38.0-pre1 | 17 | 10/11/2023 |
2.37.0 | 80 | 05/24/2021 |
2.37.0-pre1 | 13 | 08/14/2023 |
2.36.0 | 46 | 03/19/2021 |
2.36.0-pre1 | 15 | 11/13/2023 |
2.35.0 | 27 | 03/03/2021 |
2.35.0-pre1 | 15 | 06/30/2023 |
2.34.0 | 58 | 01/13/2021 |
2.34.0-pre1 | 13 | 06/05/2023 |
2.33.1 | 21 | 12/16/2020 |
2.33.1-pre1 | 18 | 06/30/2023 |
2.32.0 | 117 | 08/02/2021 |
2.32.0-pre1 | 20 | 06/16/2023 |
2.31.0 | 23 | 11/18/2023 |
2.31.0-pre2 | 16 | 10/16/2023 |
2.30.0 | 14 | 11/07/2023 |
2.30.0-pre1 | 15 | 01/10/2024 |
2.29.0 | 14 | 08/19/2023 |
2.29.0-pre1 | 13 | 12/04/2023 |
2.28.0 | 20 | 11/13/2023 |
2.28.0-pre2 | 16 | 02/18/2024 |
2.28.0-pre1 | 12 | 02/04/2024 |
2.27.0 | 13 | 12/29/2023 |
2.27.0-pre1 | 11 | 01/21/2024 |
2.26.0 | 18 | 11/29/2023 |
2.26.0-pre1 | 13 | 03/08/2024 |
2.25.0 | 17 | 12/25/2023 |
2.25.0-pre1 | 16 | 10/16/2023 |
2.24.0 | 19 | 10/20/2023 |
2.24.0-pre1 | 17 | 10/10/2023 |
2.23.2 | 17 | 11/26/2023 |
0.2.23-pre2 | 15 | 01/06/2024 |
0.2.23-pre1 | 14 | 10/11/2023 |
0.1.22-pre3 | 14 | 12/03/2023 |
0.1.22-pre2 | 15 | 10/23/2023 |
0.1.22-pre1 | 15 | 10/13/2023 |
0.1.21-pre1 | 14 | 11/25/2023 |