Grpc.Net.Client.Web 2.70.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
HttpMessageHandlerthat makes the gRPC HTTP request, for example,HttpClientHandler. - GrpcWebMode: An enumeration type that specifies whether the gRPC HTTP request
Content-Typeisapplication/grpc-weborapplication/grpc-web-text.GrpcWebMode.GrpcWebconfigures content to be sent without encoding. Default value.GrpcWebMode.GrpcWebTextconfigures content to be base64 encoded. Required for server streaming calls in browsers.
- HttpVersion: HTTP protocol
Versionused to setHttpRequestMessage.Versionon 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
No packages depend on Grpc.Net.Client.Web.
.NET 6.0
- No dependencies.
.NET 7.0
- No dependencies.
.NET 8.0
- No dependencies.
.NET Standard 2.0
- System.Memory (>= 4.5.3)
.NET Standard 2.1
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 2.84.0 | 2 | 09/23/2026 |
| 2.84.0-pre1 | 2 | 09/23/2026 |
| 2.83.0 | 3 | 08/06/2026 |
| 2.83.0-pre1 | 4 | 08/06/2026 |
| 2.80.0 | 4 | 08/06/2026 |
| 2.80.0-pre1 | 4 | 08/06/2026 |
| 2.76.0 | 5 | 08/05/2026 |
| 2.76.0-pre1 | 4 | 08/06/2026 |
| 2.71.0 | 4 | 08/06/2026 |
| 2.71.0-pre1 | 4 | 08/06/2026 |
| 2.70.0 | 4 | 08/06/2026 |
| 2.70.0-pre1 | 4 | 08/06/2026 |
| 2.67.0 | 4 | 08/06/2026 |
| 2.67.0-pre1 | 4 | 08/06/2026 |
| 2.66.0 | 4 | 08/06/2026 |
| 2.66.0-pre1 | 4 | 08/06/2026 |
| 2.65.0 | 4 | 08/06/2026 |
| 2.65.0-pre1 | 4 | 08/06/2026 |
| 2.64.0 | 4 | 08/06/2026 |
| 2.64.0-pre1 | 4 | 08/06/2026 |
| 2.63.0 | 4 | 08/06/2026 |
| 2.63.0-pre1 | 4 | 08/06/2026 |
| 2.62.0 | 4 | 08/06/2026 |
| 2.62.0-pre1 | 4 | 08/06/2026 |
| 2.61.0 | 4 | 08/06/2026 |
| 2.61.0-pre1 | 4 | 08/06/2026 |
| 2.60.0 | 4 | 08/06/2026 |
| 2.60.0-pre1 | 4 | 08/06/2026 |
| 2.59.0 | 4 | 08/06/2026 |
| 2.59.0-pre1 | 4 | 08/06/2026 |
| 2.58.0 | 4 | 08/06/2026 |
| 2.58.0-pre1 | 4 | 08/06/2026 |
| 2.57.0 | 4 | 08/06/2026 |
| 2.57.0-pre1 | 4 | 08/06/2026 |
| 2.56.0 | 4 | 08/06/2026 |
| 2.56.0-pre2 | 4 | 08/06/2026 |
| 2.56.0-pre1 | 4 | 08/06/2026 |
| 2.55.0 | 4 | 08/06/2026 |
| 2.55.0-pre1 | 4 | 08/06/2026 |
| 2.54.0 | 4 | 08/06/2026 |
| 2.54.0-pre1 | 4 | 08/06/2026 |
| 2.53.0 | 4 | 08/06/2026 |
| 2.53.0-pre1 | 4 | 08/06/2026 |
| 2.52.0 | 4 | 08/06/2026 |
| 2.52.0-pre1 | 4 | 08/06/2026 |
| 2.51.0 | 4 | 08/06/2026 |
| 2.51.0-pre1 | 4 | 08/06/2026 |
| 2.50.0 | 4 | 08/06/2026 |
| 2.50.0-pre1 | 4 | 08/06/2026 |
| 2.49.0 | 4 | 08/06/2026 |
| 2.49.0-pre1 | 4 | 08/06/2026 |
| 2.48.0 | 4 | 08/06/2026 |
| 2.48.0-pre1 | 4 | 08/06/2026 |
| 2.47.0 | 4 | 08/06/2026 |
| 2.47.0-pre1 | 4 | 08/06/2026 |
| 2.46.0 | 4 | 08/06/2026 |
| 2.46.0-pre1 | 4 | 08/06/2026 |
| 2.45.0 | 4 | 08/06/2026 |
| 2.45.0-pre1 | 4 | 08/06/2026 |
| 2.44.0 | 4 | 08/06/2026 |
| 2.44.0-pre1 | 4 | 08/06/2026 |
| 2.43.0 | 4 | 08/06/2026 |
| 2.43.0-pre1 | 4 | 08/06/2026 |
| 2.42.0 | 4 | 08/06/2026 |
| 2.42.0-pre1 | 4 | 08/06/2026 |
| 2.41.0 | 4 | 08/06/2026 |
| 2.41.0-pre1 | 4 | 08/06/2026 |
| 2.40.0 | 4 | 08/06/2026 |
| 2.40.0-pre1 | 4 | 08/06/2026 |
| 2.39.0 | 4 | 08/06/2026 |
| 2.39.0-pre1 | 4 | 08/06/2026 |
| 2.38.0 | 4 | 08/06/2026 |
| 2.38.0-pre1 | 4 | 08/06/2026 |
| 2.37.0 | 4 | 08/06/2026 |
| 2.37.0-pre1 | 4 | 08/06/2026 |
| 2.36.0 | 4 | 08/06/2026 |
| 2.36.0-pre1 | 4 | 08/06/2026 |
| 2.35.0 | 4 | 08/06/2026 |
| 2.35.0-pre1 | 4 | 08/06/2026 |
| 2.34.0 | 4 | 08/06/2026 |
| 2.34.0-pre1 | 4 | 08/06/2026 |
| 2.33.1 | 4 | 08/06/2026 |
| 2.33.1-pre1 | 4 | 08/06/2026 |
| 2.32.0 | 4 | 08/06/2026 |
| 2.32.0-pre1 | 4 | 08/06/2026 |
| 2.31.0 | 4 | 08/06/2026 |
| 2.31.0-pre2 | 4 | 08/06/2026 |
| 2.30.0 | 4 | 08/06/2026 |
| 2.30.0-pre1 | 4 | 08/06/2026 |
| 2.29.0 | 3 | 08/06/2026 |
| 2.29.0-pre1 | 4 | 08/06/2026 |
| 2.28.0-pre2 | 4 | 08/06/2026 |
| 2.28.0-pre1 | 4 | 08/06/2026 |
| 2.27.0-pre1 | 4 | 08/06/2026 |