Grpc.Net.Client.Web
2.57.0
dotnet add package Grpc.Net.Client.Web --version 2.57.0
NuGet\Install-Package Grpc.Net.Client.Web -Version 2.57.0
<PackageReference Include="Grpc.Net.Client.Web" Version="2.57.0" />
paket add Grpc.Net.Client.Web --version 2.57.0
#r "nuget: Grpc.Net.Client.Web, 2.57.0"
// Install Grpc.Net.Client.Web as a Cake Addin
#addin nuget:?package=Grpc.Net.Client.Web&version=2.57.0
// Install Grpc.Net.Client.Web as a Cake Tool
#tool nuget:?package=Grpc.Net.Client.Web&version=2.57.0
Grpc.Net.Client.Web
The .NET gRPC client can be configured to make gRPC-Web calls. This is useful for Blazor WebAssembly apps, which are hosted in the browser and have the same HTTP limitations of JavaScript code. Calling gRPC-Web with a .NET client is the same as HTTP/2 gRPC. The only modification is how the channel is created.
To use gRPC-Web:
- Add a reference to the Grpc.Net.Client.Web package.
- Ensure the reference to Grpc.Net.Client package is 2.29.0 or greater.
- Configure the channel to use the
GrpcWebHandler
:
var channel = GrpcChannel.ForAddress("https://localhost:5001", new GrpcChannelOptions
{
HttpHandler = new GrpcWebHandler(new HttpClientHandler())
});
var client = new Greeter.GreeterClient(channel);
var response = await client.SayHelloAsync(new HelloRequest { Name = ".NET" });
The preceding code:
- Configures a channel to use gRPC-Web.
- Creates a client and makes a call using the channel.
GrpcWebHandler
has the following configuration options:
- InnerHandler: The underlying
HttpMessageHandler
that makes the gRPC HTTP request, for example,HttpClientHandler
. - GrpcWebMode: An enumeration type that specifies whether the gRPC HTTP request
Content-Type
isapplication/grpc-web
orapplication/grpc-web-text
.GrpcWebMode.GrpcWeb
configures content to be sent without encoding. Default value.GrpcWebMode.GrpcWebText
configures content to be base64 encoded. Required for server streaming calls in browsers.
- HttpVersion: HTTP protocol
Version
used to setHttpRequestMessage.Version
on the underlying gRPC HTTP request. gRPC-Web doesn't require a specific version and doesn't override the default unless specified.
gRPC-Web and streaming
Traditional gRPC over HTTP/2 supports streaming in all directions. gRPC-Web offers limited support for streaming:
- gRPC-Web browser clients don't support calling client streaming and bidirectional streaming methods.
- gRPC-Web .NET clients don't support calling client streaming and bidirectional streaming methods over HTTP/1.1.
- ASP.NET Core gRPC services hosted on Azure App Service and IIS don't support bidirectional streaming.
When using gRPC-Web, we only recommend the use of unary methods and server streaming methods.
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. |
.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
- System.Memory (>= 4.5.3)
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (30)
Showing the top 5 NuGet packages that depend on Grpc.Net.Client.Web:
Package | Downloads |
---|---|
M5x.Grpc
Package Description |
|
Toggly.FeatureManagement
Toggly.FeatureManagement extends Microsoft.FeatureManagement with extensions to handle feature state changes, Decorate and register services that are injected when a feature is on, feature usage tracking, and integration with toggly.io |
|
Momento.Sdk
C# SDK for Momento, a serverless cache that automatically scales without any of the operational overhead required by traditional caching solutions. Check out our SDK example here: https://github.com/momentohq/client-sdk-dotnet/tree/main/examples |
|
CRZ
Package Description |
|
GamesCheetah.RealtimeEmbeddedServer
Package Description |
GitHub repositories (12)
Showing the top 5 popular GitHub repositories that depend on Grpc.Net.Client.Web:
Repository | Stars |
---|---|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 2.1, 2.2, 3.1, 5.0, 6.0, 7.0 and 8.0 RC 1 projects you can use. Readme contains explanations on all projects.
|
|
grpc/grpc-dotnet
gRPC for .NET
|
|
abpframework/abp-samples
Sample solutions built with the ABP Framework
|
|
gustavnavar/Grid.Blazor
Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
|
|
microsoft/RockPaperScissorsLizardSpock
Rock, Paper, Scissors, Lizard, Spock - Sample Application
|
Version | Downloads | Last updated |
---|---|---|
2.57.0 | 14,826 | 9/6/2023 |
2.57.0-pre1 | 114 | 8/31/2023 |
2.56.0 | 14,297 | 8/25/2023 |
2.56.0-pre2 | 145 | 8/16/2023 |
2.56.0-pre1 | 317 | 8/3/2023 |
2.55.0 | 87,488 | 7/4/2023 |
2.55.0-pre1 | 122 | 6/23/2023 |
2.54.0 | 35,532 | 6/15/2023 |
2.54.0-pre1 | 282 | 5/25/2023 |
2.53.0 | 84,645 | 5/5/2023 |
2.53.0-pre1 | 211 | 4/12/2023 |
2.52.0 | 191,134 | 3/15/2023 |
2.52.0-pre1 | 215 | 3/3/2023 |
2.51.0 | 238,117 | 1/2/2023 |
2.51.0-pre1 | 378 | 12/7/2022 |
2.50.0 | 156,887 | 11/17/2022 |
2.50.0-pre1 | 458 | 11/3/2022 |
2.49.0 | 243,428 | 9/26/2022 |
2.49.0-pre1 | 1,028 | 9/1/2022 |
2.48.0 | 155,133 | 8/24/2022 |
2.48.0-pre1 | 327 | 8/17/2022 |
2.47.0 | 183,302 | 7/3/2022 |
2.47.0-pre1 | 716 | 6/23/2022 |
2.46.0 | 141,985 | 5/13/2022 |
2.46.0-pre1 | 962 | 4/28/2022 |
2.45.0 | 130,611 | 4/19/2022 |
2.45.0-pre1 | 345 | 4/7/2022 |
2.44.0 | 67,291 | 3/17/2022 |
2.44.0-pre1 | 1,109 | 3/9/2022 |
2.43.0 | 108,402 | 2/25/2022 |
2.43.0-pre1 | 5,272 | 1/28/2022 |
2.42.0 | 119,799 | 1/19/2022 |
2.42.0-pre1 | 3,707 | 12/30/2021 |
2.41.0 | 160,433 | 12/7/2021 |
2.41.0-pre1 | 24,360 | 11/12/2021 |
2.40.0 | 526,987 | 10/5/2021 |
2.40.0-pre1 | 578 | 9/9/2021 |
2.39.0 | 140,171 | 8/18/2021 |
2.39.0-pre1 | 40,765 | 8/6/2021 |
2.38.0 | 190,165 | 6/11/2021 |
2.38.0-pre1 | 475 | 6/4/2021 |
2.37.0 | 95,389 | 4/20/2021 |
2.37.0-pre1 | 329 | 4/14/2021 |
2.36.0 | 38,703 | 3/17/2021 |
2.36.0-pre1 | 640 | 3/9/2021 |
2.35.0 | 50,249 | 2/4/2021 |
2.35.0-pre1 | 276 | 1/26/2021 |
2.34.0 | 86,304 | 12/11/2020 |
2.34.0-pre1 | 404 | 12/1/2020 |
2.33.1 | 42,618 | 10/28/2020 |
2.33.1-pre1 | 391 | 10/22/2020 |
2.32.0 | 8,330 | 10/5/2020 |
2.32.0-pre1 | 988 | 9/8/2020 |
2.31.0 | 18,239 | 8/14/2020 |
2.31.0-pre2 | 370 | 8/3/2020 |
2.30.0 | 16,870 | 7/16/2020 |
2.30.0-pre1 | 985 | 6/17/2020 |
2.29.0 | 17,253 | 5/27/2020 |
2.29.0-pre1 | 818 | 5/15/2020 |
2.28.0-pre2 | 6,927 | 3/11/2020 |
2.28.0-pre1 | 9,176 | 3/3/2020 |
2.27.0-pre1 | 6,282 | 1/24/2020 |