We recommend migrating to the new package, PatrickJahr.GrpcWeb.DevTools, which offers improved features and better compatibility with the latest Blazor versions.
gRPC-Web is becoming increasingly popular in the .NET world and, of course, in Blazor.
But not only the technology, also the tooling for gRPC-Web has an important role. For some time now, there has been a Chrome browser extension for the gRPC-Web Developer Tools.
I have made it my task to make this incredibly useful tool also usable for Blazor :-)
You need .NET 7.0 or newer to use this library.
You also need the gRPC-Web Developer Tools Chrome Extsion
Install gRPC-Web Developer Tools
The gRPC-Web Developer Tools only available for Google Chrome and Microsoft Edge browser.
You can install the package via NuGet with the Package Manager in your IDE or alternatively using the command line:
dotnet add package Thinktecture.Blazor.GrpcWebDevTools
The package can be used in Blazor WebAssembly projects.
At first you have to register a GrpcChannel
in your ServiceCollection
like this:
builder.Services.AddScoped(services =>
{
var channel = GrpcChannel.ForAddress(backendUrl,
new GrpcChannelOptions
{
HttpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler())
});
return channel;
});
Then you can add your gRPC-Services with the extension method AddGrpcService<T>
:
builder.Services.AddGrpcService<IConferencesService>();
builder.Services.AddGrpcService<ITimeService>();
To enable the gRPC-Web Developer Tools on your project you have two opportunities:
- First you can enable them via the AppSettings:
{
"GrpcDevToolsEnabled": true
}
- Or you can enable them with the extension method
EnableGrpcWebDevTools
in yourProgram.cs
:
builder.Services.EnableGrpcWebDevTools();
BSD-3-Clause.
This is a technical showcase, not an official Thinktecture product.