Grpc.Net.Client.Web 2.51.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET 5.0 .NET Standard 2.0
dotnet add package Grpc.Net.Client.Web --version 2.51.0
NuGet\Install-Package Grpc.Net.Client.Web -Version 2.51.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.
<PackageReference Include="Grpc.Net.Client.Web" Version="2.51.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Grpc.Net.Client.Web --version 2.51.0
#r "nuget: Grpc.Net.Client.Web, 2.51.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.Client.Web as a Cake Addin
#addin nuget:?package=Grpc.Net.Client.Web&version=2.51.0

// Install Grpc.Net.Client.Web as a Cake Tool
#tool nuget:?package=Grpc.Net.Client.Web&version=2.51.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 is application/grpc-web or application/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 set HttpRequestMessage.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.

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 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.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 net481
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.
  • .NETStandard 2.0

  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (23)

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

Package Downloads
M5x.Grpc

Package Description

CRZ

Package Description

Sitko.Core.Grpc.Client.Web

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

Plumberd.Client.GrpcProxy

Package Description

Havit.Blazor.Grpc.Client The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

HAVIT Blazor stack - gRPC Support - client-side

GitHub repositories (9)

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 and 7.0 projects you can use. Readme contains explanations on all projects.
grpc/grpc-dotnet
gRPC for .NET
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
SteveSandersonMS/BlazeOrbital
Sample application for Blazor WebAssembly on .NET 6
Version Downloads Last updated
2.51.0 16,960 1/2/2023
2.51.0-pre1 242 12/7/2022
2.50.0 46,299 11/17/2022
2.50.0-pre1 211 11/3/2022
2.49.0 96,448 9/26/2022
2.49.0-pre1 830 9/1/2022
2.48.0 68,236 8/24/2022
2.48.0-pre1 274 8/17/2022
2.47.0 126,884 7/3/2022
2.47.0-pre1 648 6/23/2022
2.46.0 92,978 5/13/2022
2.46.0-pre1 876 4/28/2022
2.45.0 98,144 4/19/2022
2.45.0-pre1 261 4/7/2022
2.44.0 51,642 3/17/2022
2.44.0-pre1 1,044 3/9/2022
2.43.0 61,190 2/25/2022
2.43.0-pre1 5,196 1/28/2022
2.42.0 94,846 1/19/2022
2.42.0-pre1 3,550 12/30/2021
2.41.0 121,301 12/7/2021
2.41.0-pre1 24,265 11/12/2021
2.40.0 301,767 10/5/2021
2.40.0-pre1 508 9/9/2021
2.39.0 104,290 8/18/2021
2.39.0-pre1 23,878 8/6/2021
2.38.0 168,478 6/11/2021
2.38.0-pre1 423 6/4/2021
2.37.0 89,386 4/20/2021
2.37.0-pre1 272 4/14/2021
2.36.0 36,879 3/17/2021
2.36.0-pre1 576 3/9/2021
2.35.0 47,579 2/4/2021
2.35.0-pre1 224 1/26/2021
2.34.0 84,194 12/11/2020
2.34.0-pre1 352 12/1/2020
2.33.1 24,136 10/28/2020
2.33.1-pre1 327 10/22/2020
2.32.0 7,784 10/5/2020
2.32.0-pre1 886 9/8/2020
2.31.0 16,161 8/14/2020
2.31.0-pre2 314 8/3/2020
2.30.0 16,757 7/16/2020
2.30.0-pre1 919 6/17/2020
2.29.0 15,370 5/27/2020
2.29.0-pre1 765 5/15/2020
2.28.0-pre2 6,843 3/11/2020
2.28.0-pre1 9,016 3/3/2020
2.27.0-pre1 6,132 1/24/2020