Getting error "HttpRequestException: Unable to get subchannel from HttpRequestMessage." after upgrading from .NET Core 3.1 to .NET 6.0
See original GitHub issueWhat version of gRPC and what language are you using?
Grpc.Net.Client : 2.51.0 C#
What operating system (Linux, Windows,…) and version?
Windows
What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info
)
.NET 6.0
What did you do?
Updated the project from .NET Core 3.1 to .NET 6.0
What did you expect to see?
Grpc calls working fine
What did you see instead?
Seeing error “HttpRequestException: Unable to get subchannel from HttpRequestMessage.” at one of our customers that use a proxy server.
Creating the GRPC channel as below
var channel = GrpcChannel.ForAddress(URI);
Stack Trace
Status(StatusCode=“Internal”, Detail=“Error starting gRPC call. HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy URI) InvalidOperationException: Unable to get subchannel from HttpRequestMessage.”, DebugException=“System.Net.Http.HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy URI)
—> System.InvalidOperationException: Unable to get subchannel from HttpRequestMessage.
at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.OnConnect(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
— End of inner exception stack trace —
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.EstablishProxyTunnelAsync(Boolean async, HttpRequestHeaders headers, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp2ConnectionAsync(HttpRequestMessage request) at System.Threading.Tasks.TaskCompletionSourceWithCancellation
1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp2ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Grpc.Net.Client.Internal.GrpcCall2.RunCall(HttpRequestMessage request, Nullable
1 timeout)”)|
Anything else we should know about your project / environment?
Customer environment use a proxy server. The issue is seen after updating from .NET Core 3.1 to .NET 6.0
Issue Analytics
- State:
- Created 5 months ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
I forgot I had Proxyman (Fiddler alt for Mac) running and got this same exact error on my dev machine. 🤦
@JamesNK we have exact the same problem in .Net 7.0 when we use Fiddler Everywhere, I’m not sure what we have to do to make it work with Fiddler, just add
new GrpcChannelOptions { Handler = new HttpClientHandler() });
?If adding the HttpClientHandler is enough, could you please elaborate what this is doing and why we need that?
br