Problem:
On the server side
Microsoft.AspNetCore.Server.Kestrel[0]
HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint.

Attempts to solve:
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<h1>Hello, gRPC!</h1>
@using Tasly.Service
@using Grpc.Core
<button class="btn btn-primary" onclick="@SayHello()">RUN</button>
<hr />
<p>@Greeting</p>
@functions {
private string Greeting;
async Task SayHello()
{
var channel = new Channel("localhost:5001", ChannelCredentials.Insecure);
var client = new Greeter.GreeterClient(channel);
var reply = await client.SayHelloAsync(new HelloRequest { Name = "Blazor gRPC Client" });
Greeting = reply.Message;
await channel.ShutdownAsync();
}
}
If you have any suggestions about how to fix, or if you need more information, please let me know.
ChannelCredentials.Insecure means HTTPS is not used. Grpc.Net.Client package contains a gRPC client that uses HttpClient internally, which makes HTTPS much easier. If you want to use Grpc.Core client then you should ask on grpc/grpc for help.
This issue occurred for me even though I have used Grpc.Net.Client package. In fact the sample downloaded from https://github.com/aspnet/AspNetCore.Docs also have the same problem.
Most helpful comment
This issue occurred for me even though I have used Grpc.Net.Client package. In fact the sample downloaded from https://github.com/aspnet/AspNetCore.Docs also have the same problem.