Grpc.Net.ClientFactory 2.70.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 |
---|
Microsoft.Azure.Functions.Worker
Package Description
|
Microsoft.Azure.Functions.Worker
This library enables you to create an Azure Functions .NET Worker, adding support for the isolated, out-of-process execution model.
|
Microsoft.Azure.Functions.Worker.Grpc
This library provides gRPC support for Azure Functions .NET Worker communication with the Azure Functions Host.
|
.NET 6.0
- Grpc.Net.Client (>= 2.70.0)
- Microsoft.Extensions.Http (>= 6.0.0)
.NET 7.0
- Grpc.Net.Client (>= 2.70.0)
- Microsoft.Extensions.Http (>= 6.0.0)
.NET 8.0
- Grpc.Net.Client (>= 2.70.0)
- Microsoft.Extensions.Http (>= 6.0.0)
.NET Standard 2.0
- Grpc.Net.Client (>= 2.70.0)
- Microsoft.Extensions.Http (>= 6.0.0)
.NET Standard 2.1
- Grpc.Net.Client (>= 2.70.0)
- Microsoft.Extensions.Http (>= 6.0.0)
Version | Last updated |
---|---|
2.71.0 | 04/25/2025 |
2.71.0-pre1 | 04/16/2025 |
2.70.0 | 04/21/2025 |
2.70.0-pre1 | 02/26/2025 |
2.67.0 | 11/21/2024 |
2.67.0-pre1 | 10/22/2024 |
2.66.0 | 09/20/2024 |
2.66.0-pre1 | 09/06/2024 |
2.65.0 | 07/27/2024 |
2.65.0-pre1 | 07/20/2024 |
2.64.0 | 07/19/2024 |
2.64.0-pre1 | 07/15/2024 |
2.63.0 | 05/24/2024 |
2.63.0-pre1 | 05/08/2024 |
2.62.0 | 03/29/2024 |
2.62.0-pre1 | 03/08/2024 |
2.61.0 | 04/21/2025 |
2.61.0-pre1 | 02/08/2024 |
2.60.0 | 01/03/2024 |
2.60.0-pre1 | 12/14/2023 |
2.59.0 | 11/08/2023 |
2.59.0-pre1 | 10/27/2023 |
2.58.0 | 10/19/2023 |
2.58.0-pre1 | 10/09/2023 |
2.57.0 | 09/06/2023 |
2.57.0-pre1 | 08/31/2023 |
2.56.0 | 08/25/2023 |
2.56.0-pre2 | 08/16/2023 |
2.56.0-pre1 | 08/03/2023 |
2.55.0 | 07/04/2023 |
2.55.0-pre1 | 06/23/2023 |
2.54.0 | 06/15/2023 |
2.54.0-pre1 | 05/25/2023 |
2.53.0 | 05/05/2023 |
2.53.0-pre1 | 04/12/2023 |
2.52.0 | 03/15/2023 |
2.52.0-pre1 | 03/03/2023 |
2.51.0 | 01/02/2023 |
2.51.0-pre1 | 12/07/2022 |
2.50.0 | 11/17/2022 |
2.50.0-pre1 | 11/03/2022 |
2.49.0 | 09/26/2022 |
2.49.0-pre1 | 09/01/2022 |
2.48.0 | 08/24/2022 |
2.48.0-pre1 | 08/17/2022 |
2.47.0 | 07/03/2022 |
2.47.0-pre1 | 06/23/2022 |
2.46.0 | 05/13/2022 |
2.46.0-pre1 | 04/28/2022 |
2.45.0 | 04/19/2022 |
2.45.0-pre1 | 04/07/2022 |
2.44.0 | 03/17/2022 |
2.44.0-pre1 | 03/09/2022 |
2.43.0 | 02/25/2022 |
2.43.0-pre1 | 01/28/2022 |
2.42.0 | 01/19/2022 |
2.42.0-pre1 | 12/30/2021 |
2.41.0 | 12/07/2021 |
2.41.0-pre1 | 11/12/2021 |
2.40.0 | 10/05/2021 |
2.40.0-pre1 | 09/09/2021 |
2.39.0 | 08/18/2021 |
2.39.0-pre1 | 08/06/2021 |
2.38.0 | 06/11/2021 |
2.38.0-pre1 | 06/04/2021 |
2.37.0 | 04/20/2021 |
2.37.0-pre1 | 04/14/2021 |
2.36.0 | 03/17/2021 |
2.36.0-pre1 | 03/09/2021 |
2.35.0 | 02/04/2021 |
2.35.0-pre1 | 01/26/2021 |
2.34.0 | 12/11/2020 |
2.34.0-pre1 | 12/01/2020 |
2.33.1 | 10/28/2020 |
2.33.1-pre1 | 10/22/2020 |
2.32.0 | 10/05/2020 |
2.32.0-pre1 | 09/08/2020 |
2.31.0 | 08/14/2020 |
2.31.0-pre2 | 08/03/2020 |
2.30.0 | 07/16/2020 |
2.30.0-pre1 | 06/17/2020 |
2.29.0 | 05/27/2020 |
2.29.0-pre1 | 05/15/2020 |
2.28.0 | 04/09/2020 |
2.28.0-pre2 | 03/11/2020 |
2.28.0-pre1 | 03/03/2020 |
2.27.0 | 02/07/2020 |
2.27.0-pre1 | 01/24/2020 |
2.26.0 | 12/19/2019 |
2.26.0-pre1 | 12/10/2019 |
2.25.0 | 11/07/2019 |
2.25.0-pre1 | 11/01/2019 |
2.24.0 | 10/21/2019 |
2.24.0-pre1 | 10/09/2019 |
2.23.2 | 09/20/2019 |
0.2.23-pre2 | 09/06/2019 |
0.2.23-pre1 | 04/21/2025 |
0.1.22-pre3 | 07/30/2019 |
0.1.22-pre2 | 07/02/2019 |
0.1.22-pre1 | 06/17/2019 |
0.1.21-pre1 | 06/04/2019 |