-
Notifications
You must be signed in to change notification settings - Fork 796
.NET Core 3 fails accepting Java client calls #564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, We have the same issue, I reported it here: There is an repo for reproduction here: Also this is client long for package sniff: |
I think this is your problem:
Either use a secure connection from the client, or disable TLS on the server. |
Interesting suggestion for a solution? Because I could swear I have done it. Maybe I have missed something ? ManagedChannelBuilder managedChannelBuilder = ManagedChannelBuilder
.forAddress(mUrl, mPort)
.keepAliveTime(3, TimeUnit.MINUTES)
.keepAliveTimeout(30, TimeUnit.SECONDS).
.usePlaintext()
.build(); On the server side I use the appsettings.json {
"Kestrel": {
"Endpoints": {
"Grpc": {
"Url": "http://*:13377",
"Protocols": "Http2"
}
}
}
} As you can notice there is no "Certificate" path provided. |
Edit: Actually, looking at your appsettings.json you might already not have TLS on that endpoint. I'm not incredibly familiar with setting up endpoints via appsettings.json. ASP.NET Core automatically provides a HTTPS endpoint using a development certificate. By default:
Connect to port 5000. |
Thanks James I checked the link, and even though I don't see much difference in regards of configuring an endpoing via json config, tomorrow I am definitely going to try to not use a custom port, but rather the default port 5000 and see if that fixes it. However shouldn't this behavior be rather flexible rather than dependable on default ports? Is it possible to CC someone that is a bit more familiar with endpoint configuration, just for sanity check, since the configuration above (which also included an http1.1 on a different port) worked without a problem on .NET Core preview7? (I checked the release notes from that preview to GA and there seems to not be any breaking changes in this area). Edit: app.UseHsts();
app.UseHttpsRedirection(); |
Custom ports should work. Although some OSes block certain port ranges. I will try your appsetting.json when I have time. One thing you could try is configuring the endpoint in Program.cs: .ConfigureKestrel((context, options) =>
{
options.ListenAnyIP(50052, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
});
}) Uses port 50052 which I think is relatively safe to use. |
Hi @JamesNK , I read in details "Make it easier to configure Kestrel endpoints from config" issue and based on that I do not think my config was incorrect. ...
.ConfigureKestrel((context, kestrelOptions) =>
{
kestrelOptions.ListenAnyIP(50052, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
});
kestrelOptions.ListenAnyIP(50051, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1;
});
})
... And the problem still persist. I am able to access all the grpc endpoints, just not using Java client. Now if you run the solution using docker-compose, you would have 3 endpoints (All set to not use TLS):
However if you run the Android solution and try to connect to the server[http://localhost:50052/] (that works fine with .NET Client) you would get the same exception, that was in the original post. I would also like to point out that, there are problems with people using .NET Client, trying to connect to Java Server. Is it possible that there is some sort of misalignment, between Java and .NET? Edit: //host and port variables are takes from the input boxes.
channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build();
GreeterGrpc.GreeterBlockingStub stub = GreeterGrpc.newBlockingStub(channel); |
Could the issue be that the Android client doesn't support plaintext (aka non-TLS) HTTP/2 calls? |
Hi @JamesNK short answer should be NO, because internally we develop on plaintext for 1.5 years, however we used: https://github.com/grpc/grpc/tree/master/src/csharp (For server side) NB!: The grpc guys forked OkHTTPClient and did some internal changes for the purpose of gRPC. Btw if I plug this: https://github.com/grpc/grpc/tree/master/examples/csharp/Helloworld Today I am going to do everything securely and inform you what would the result of that be. |
Ok. When I have time I will see if I can get Android setup on my computer and test myself. |
@JamesNK Over SSL it works fine. |
I've managed to recreate this. I suspect the issue is in Kestrel's implementation of HTTP/2. Something about the HTTP/2 request from the Android client is causing Kestrel to reject it. Kestrel issue: dotnet/aspnetcore#14745 |
Closing as fixed in Java client. Kestrel discussion: dotnet/aspnetcore#14745 |
Uh oh!
There was an error while loading. Please reload this page.
Issue description
We are transitioning our micro-services from .NET Core 2.1 with the old gRPC dotnet nuget, to .NET Core 3.0 with the inbuilt support for gRPC in Kestrel.
One of our clients is Android app.
When tried to connect from the Android client:
Set up is Development, it's over HTTP, no TLS has been enabled.
Someone reported the same issue on stackoverflow for Kotlin
I want to point out that we tried the same Stubs with different clients like .NET Core 3.0/ Swift and even BlazorRPC and they worked without an issue.
General version information
gRPC:
Java uses : 1.23.0
.NET uses: 2.23.2
Windows 10
Docker for Win 19.03.2
Images used for building the docker final image:
mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
How to reproduce:
The text was updated successfully, but these errors were encountered: