Skip to content

Service -> OTEL fail with "Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection." #1818

Open

Description

@thomas-girotto

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

  1. ghost added
    area-integrations
    on Jan 24, 2024
  2. added
    area-telemetry
    and removed
    area-integrations
    on Jan 24, 2024
  3. davidfowl commented on Jan 24, 2024

    @davidfowl
    Collaborator
  4. danmoseley commented on Mar 6, 2024

    @danmoseley
    Contributor

    James Newton-King (@JamesNK) Is there work here for GA?

  5. JamesNK commented on Mar 6, 2024

    @JamesNK
    Member

    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?

  6. davidfowl commented on Mar 8, 2024

    @davidfowl
    Collaborator

    Moving this to P5 for investigation.

    cc Miha Zupan (@MihaZupan)

  7. MihaZupan commented on Mar 8, 2024

    @MihaZupan
    Member

    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.

  8. davidfowl commented on Mar 9, 2024

    @davidfowl
    Collaborator

    We should move this to a dotnet/runtime then correct?

  9. JamesNK commented on Mar 13, 2024

    @JamesNK
    Member

    We don't currently allow non-https traffic to use HTTP/2 when talking through an http/https proxy.

    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.

  10. MihaZupan commented on Mar 13, 2024

    @MihaZupan
    Member

    Filed dotnet/runtime#99689 to track it there.

    The current workarounds would be:

    • Use https if possible?
    • Don't use a proxy for these requests
    • Use a SOCKS proxy instead of HTTP if supported by the proxy
  11. MihaZupan commented on Mar 26, 2024

    @MihaZupan
    Member

    Is this important for .NET 9.0 for Aspire?

  12. davidfowl commented on Mar 26, 2024

    @davidfowl
    Collaborator

    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.

  13. davidfowl commented on Mar 30, 2024

    @davidfowl
    Collaborator

    Moving to backlog

  14. hillin commented on Apr 23, 2025

    @hillin

    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": ""
          }
        }
      }
    }
    
  15. MihaZupan commented on Jun 30, 2026

    @MihaZupan
    Member

    Support for doing cleartext H2 over a proxy tunnel has been merged into main for .NET 11 now dotnet/runtime#129485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-telemetryarea-templates

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions