Skip to content

UseHttpEndpoint ignored unless DAPR_GRPC_PORT is set in .NET SDK #1641

@Hamza091

Description

@Hamza091

Expected Behavior

I expected the Dapr .NET SDK to communicate over HTTP when explicitly configured with UseHttpEndpoint, without requiring gRPC-related environment variables (DAPR_GRPC_PORT, DAPR_GRPC_ENDPOINT).


Actual Behavior

  • With only HTTP environment variables set (DAPR_HTTP_PORT, DAPR_HTTP_ENDPOINT), the client throws connection refused errors.
  • The client only works after adding gRPC environment variables, even though my code is configured to use HTTP.
  • This suggests that the SDK may be defaulting to gRPC communication, ignoring the explicit HTTP configuration.

Steps to Reproduce the Problem

  1. Create a .NET service with the following Dapr client configuration:

    builder.Services.AddDaprClient(daprClientBuilder =>
    {
        var daprHttpPort = builder.Configuration.GetValue<string>("DAPR_HTTP_PORT") ?? "3500";
        daprClientBuilder.UseHttpEndpoint($"http://channelservice-api-dapr:{daprHttpPort}");
        daprClientBuilder.UseTimeout(TimeSpan.FromSeconds(60));
    });
  2. Run the service in Docker Compose with only HTTP env variables:

environment:
  - DAPR_HTTP_PORT=3500
  - DAPR_HTTP_ENDPOINT=http://channelservice-api-dapr:3500

Result: Client fails with connection refused.

  1. Add gRPC env variables to the same service:
environment:
  - DAPR_GRPC_PORT=50002
  - DAPR_GRPC_ENDPOINT=http://channelservice-api-dapr:50002
  - DAPR_HTTP_PORT=3500
  - DAPR_HTTP_ENDPOINT=http://channelservice-api-dapr:3500

Result: Client starts working, despite code being configured to use HTTP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions