grpc / grpc/grpc-dotnet

Request protocol 'HTTP/1.1' is not supported - Net Framework

Open
#2,510 0 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
C#
Stars
4.5k
Forks
836
Avg merge
6d 3h
Merged PRs (30d)
7

Description

I have a grpc server/client connection that works for several hundred people. However, I am running into an issue where there are a few clients that cannot connect and are receiving the error Request protocol 'HTTP/1.1' is not supported. I haven't been able to figure out, yet, why it might work for the majority of people, but a few are having issues.

The client software is in .Net Framework 4.7. Below is the code for creating the channel:
```
public string Token { get; set; }
_dataServiceAddress = "https://www.mysite.com:5001";

public GrpcChannel CreateDataChannel()
{
var credentials = CallCredentials.FromInterceptor((context, metadata) =>
{
if (!string.IsNullOrEmpty(Token))
{
metadata.Add("Authorization", $"Bearer {Token}");
}
return Task.CompletedTask;
});

var winhttpHandler = new WinHttpHandler()
{
ServerCertificateValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator,
};
SubdirectoryHandler handler = new SubdirectoryHandler(winhttpHandler, "/MySubDir");

var httpClient = new HttpClient(handler);

var channel = GrpcChannel.ForAddress(_dataServiceAddress, new GrpcChannelOptions
{
Credentials = ChannelCredentials.Create(new SslCredentials(), credentials),
HttpClient = httpClient,
});

return channel;
}
```

Any thoughts on what to ask or find out from the user that they would not be able to connect to the gRPC channel?

Their computer is running Windows 10.

Contributor guide

Open the contributing guide

Research direction

Start with CreateDataChannel and inspect how the WinHttpHandler, SubdirectoryHandler, HttpClient, and gRPC channel are configured. Compare the affected Windows 10 clients with working clients, including their .NET Framework environment and connection behavior. Done means identifying a reproducible cause for the HTTP/1.1 rejection and documenting the relevant client details or configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.