Repository navigation
Description
Hello Aspire team,
After a fresh dotnet new aspire-starter, I couldn't see any OTEL data in the dashboard...
After activating the OTEL logs (with OTEL_DIAGNOSTICS.json), i was able to see that the dotnet projects failed pushing data to the OTEL server with the following error:
Exporter failed send data to collector to {0} endpoint. Data will not be sent. Exception: {1}{http://localhost:16159/}{Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.", DebugException="System.Net.Http.HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.")
---> System.Net.Http.HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.Metrics.MetricsHandler.SendAsyncWithMetrics(HttpRequestMessage request, Boolean async, 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, Nullable1 timeout)
--- End of inner exception stack trace ---
at Grpc.Net.Client.Internal.HttpClientCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext2 ctx)
at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at OpenTelemetry.Proto.Collector.Metrics.V1.MetricsService.MetricsServiceClient.Export(ExportMetricsServiceRequest request, Metadata headers, Nullable1 deadline, CancellationToken cancellationToken)
at OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient.OtlpGrpcMetricsExportClient.SendExportRequest(ExportMetricsServiceRequest request, CancellationToken cancellationToken)}
That was because of my local setup: i'm using PX proxy, and HTTP_PROXY and HTTPS_PROXY were set to http://localhost:3128 (my px port).
By adding HTTP_PROXY="" and HTTPS_PROXY="" in all the launchSettings.json, it finally worked (but it actually took me a lot of time to figure out how to solve this !)
Maybe you could document that somewhere, or add HTTP_PROXY="" in the default template?
It is a pretty common scenario in enterprise to have this kind of proxy setup on your computer.
Thank you for the great job with Aspire, now that it works i can't wait to use it for real !
Activity
davidfowl commentedon Jan 24, 2024
cc Sam Spencer (@samsp-msft) James Newton-King (@JamesNK)
danmoseley commentedon Mar 6, 2024
James Newton-King (@JamesNK) Is there work here for GA?
JamesNK commentedon Mar 6, 2024
I'm not sure. HttpClient interaction with proxies isn't something I know a lot about.
Karel Zikmund (@karelz) Is there existing documentation about making HTTP requests between localhost apps when a proxy is configured?
davidfowl commentedon Mar 8, 2024
Moving this to P5 for investigation.
cc Miha Zupan (@MihaZupan)
MihaZupan commentedon Mar 8, 2024
We don't currently allow non-https traffic to use HTTP/2 when talking through an http/https proxy.
I don't think there's a fundamental technical limitation here that would prevent us from allowing that when Exact/OrHigher version is specified, I think it just hasn't come up yet.
For example, we'll let you tunnel H2 through a socks proxy without encryption, so I don't see why we wouldn't allow it for http proxies.
davidfowl commentedon Mar 9, 2024
We should move this to a dotnet/runtime then correct?
JamesNK commentedon Mar 13, 2024
What should we tell people who run into this error? I don't think setting values in launchSettings.json will be enough. The Aspire dashboard needs to talk to the hosting over HTTP/2, and also all the apps need to talk to the dashboard over HTTP/2.
MihaZupan commentedon Mar 13, 2024
Filed dotnet/runtime#99689 to track it there.
The current workarounds would be:
MihaZupan commentedon Mar 26, 2024
Is this important for .NET 9.0 for Aspire?
davidfowl commentedon Mar 26, 2024
Hard to tell, if customers run into it, it seems like there's no workaround? So from that POV yes? On the other hand, not many people have reported it.
davidfowl commentedon Mar 30, 2024
Moving to backlog
hillin commentedon Apr 23, 2025
Same here, setting the following environment variables in the aspire AppHost's launchSettings.json, as instructed by the OP, solves the problem for us:
{ "profiles": { "AppHost": { "environmentVariables": { "HTTP_PROXY": "", "HTTP_PROXYS": "" } } } }MihaZupan commentedon Jun 30, 2026
Support for doing cleartext H2 over a proxy tunnel has been merged into main for .NET 11 now dotnet/runtime#129485