Closed Earthmark closed 5 years ago
TLS is required if you have set Kestrel to HttpProtocols.Http1AndHttp2
. Set it to Http2
or use HTTPS.
I just discovered that with bloom as well! It'll only talk to bloom in http2 only mode, but the client still fails to connect to the http2 only service, when the bloom client does succeed.
I'm guessing this is part of the prior knowledge mode thing then, where I haven't told the client it's http2. I'll poke at that and see if I can find a resolution.
It'll only talk to bloom in http2 only mode, but the client still fails to connect to the http2 only service, when the bloom client does succeed.
The client should connect without TLS when Kestrel is Http2 only.
If I'm using a kestrel http2 only server, or the example go server provided in the issue, the grpc client provided by this library fails to connect.
Hmmm, ok. That shouldn't happen. What is your OS and dotnet version?
dotnet --info
will print out the SDK version you have installed.
Wait a second, there is an additional setting required when using HTTP/2 without TLS.
Are you setting:
// This switch must be set before creating the GrpcChannel/HttpClient.
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
That fixed it, adding that line at the start of the test cases does allow the client to connect as expected. Thanks for looking into this, I'll make sure to double check the docs in the future
In not on my machine at the moment hence not giving the dotnet info, I don't think it's needed now but in the future I'll remember to provide that by default.
I get a feeling this may be an issue with my setup, but I'm consistently seeing this behavior even after wiping the obj and bin directories of my test projects when using pre2 or pre1. I also tried wiping my nuget package caches and re-downloading the packages, this feels like a dramatically bad bug so my guess is some part of my system is borked.
I was trying to do more tests related to #516 and ran into issues where I'm now unable to communicate with a grpc-dotnet client to any grpc server. When running with a go server it just murderizes the connection, but with a kestrel server set to http1Andhttp2 this happens:
Status(StatusCode=Cancelled, Detail="Bad gRPC response. Expected HTTP status code 200. Got status code: 426")
If the kestrel server is set to only http2 the request fails with:IOException: The response ended prematurely.
I am able to seamlessly communicate with the kestrel server via bloom when set to http1+http2 mode or http2 mode. I haven't tried with a go client but I don't think I'll need to (Feel free to poke if you want me to attempt it though).
I feel I should also mention I'm not setting up tls right now, but the server seems not to care.
Issue: Clients fail to communicate to any grpc server. Expected: The client to talk http2
The code to test with:
greet.proto
Example client that fails
Go server (if you want it)
Here is also a more complicated integration test case, where it'll spin up a loopback server and play an aggressive game of ping pong with it.
EDIT: Updated the http1AndHttp2 call to just be http2, as per the comment thread where the and part is not supported, but with http2 this shows the error still.
csproj used for the code files. The client only project only generated a client, but the rest is the same, the behavior didn't change when trying to use the
Microsoft.NET.Sdk.Web
sdk.