Grpc-dotnet: HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint.

Created on 21 Jul 2019  路  2Comments  路  Source: grpc/grpc-dotnet

Problem:
On the server side

Microsoft.AspNetCore.Server.Kestrel[0]
      HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint.

Screenshot 7_21_2019 12_46_53 PM (2)

Attempts to solve:

  1. With .cshtml
@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();
    }

}

2. The same with .razor (but it doesn't work) or I used it incorrectly.

If you have any suggestions about how to fix, or if you need more information, please let me know.

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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JunTaoLuo picture JunTaoLuo  路  5Comments

davidfowl picture davidfowl  路  6Comments

rajeshaz09 picture rajeshaz09  路  5Comments

ChristianRiedl picture ChristianRiedl  路  5Comments

JamesNK picture JamesNK  路  3Comments