question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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();
    }

}
  1. 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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
kmudayakumarcommented, Aug 8, 2019

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.

5reactions
StingyJackcommented, Jan 12, 2022

@AbdoDabbas On the service I had this in the appSettings.json

{ ...
  "Kestrel": {
    "EndpointDefaults": {
      "Protocols": "Http2"
    }
  }

The c# client had to be changed to use http2 messages like this…

var req = new HttpRequestMessage(HttpMethod.Get, _myEndpoint) { Version = new Version(2, 0) };
var response = await _httpClient.SendAsync(req).ConfigureAwait(false);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Health Check Fails - HTTP/2 over TLS was not negotiated ...
I managed to resolve this by telling the health check client to specifically use HTTP version 2.0 with the following code. services.
Read more >
Breaking change: Kestrel: HTTP/2 disabled over TLS on ...
In this article​​ To enable HTTP/2 over Transport Layer Security (TLS) on Windows, two requirements need to be met: Application-Layer Protocol  ...
Read more >
Adding gRPC Service Reference problem
HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint. Visual Studiowindows 10.0visual studio 2019 version 16.7.
Read more >
tls + proxy_protocol How to set HTTP/2 ALPN?
Hi I'm using tls offloading with proxy_protocol and it's great (I see ... since it's not aware about TLS offload (endpoint is HTTP2...
Read more >
How to use HTTP/2 with HttpClient in .NET 6.0
In order to establish an HTTP/2 connection over TLS, applications need to rely on the TLS application-layer protocol negotiation (ALPN) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found