---
title: 'Downstream API call fails: Name or service not known (<projectId>:443)'
description: Check the caller's Program.cs for UseAzureDefaults(), add the missing Azure App Configuration refresh middleware, confirm the downstream service deployed to the same environment, and redeploy the caller through its normal pipeline.
id: SAIFTRBL0021
tags:
  - troubleshooting
  - service-discovery
---

# Downstream API call fails: Name or service not known (`<projectId>:443`)

Check the caller's `Program.cs` first. If it calls `builder.AddAzureDefaults()` but not `app.UseAzureDefaults()`, add `app.UseAzureDefaults()` before `UseServiceDefaults()` and redeploy through the caller's normal pipeline. If the middleware already exists, confirm that the downstream service has deployed to the caller's environment, then check the caller's environment settings.

---

## Symptom

A downstream call works locally through Aspire but fails in the deployed ASP.NET API with:

```text
Name or service not known (<projectId>:443)
```

Here, `<projectId>` is the downstream API's logical project ID, not its deployed hostname. The caller registers a Kiota client by that logical name:

```csharp
builder.ConfigureHttpClient<DownstreamApiClient, ClientCredentialsTokenProvider>(
    "<downstream-project-id>");
```

In the reported incident, Dynatrace showed a failed `HTTP connection_setup <projectId>:443` span with a child `DNS lookup <projectId>`. Caller logs showed Polly `Standard-Retry` `OnRetry` events with the same error. A logical name in the connection or DNS span distinguishes this scenario from a DNS failure for the actual deployed hostname. A logical name on the parent HTTP span alone does not prove resolution failed.

---

## Applies to

Forge ASP.NET APIs that use `SAIF.Platform` service defaults, `SAIF.Platform.Azure`, and a logical downstream service name. The reported caller used both platform packages at **3.9.1**, targeted **.NET 10**, and ran locally with **Aspire 13.5.3**. These versions match the [Forge 3 compatibility matrix](../reference/version-compatibility.md); they identify the reported setup, not an affected-version range.

This article addresses missing or stale deployed service-discovery configuration. It does not fix a DNS failure for a real hostname, an APIM backend problem, or a downstream HTTP 401/403. Do not change permissions, token scopes, or DNS records for the logical project ID to fix this symptom.

### Prerequisites and safety

- You need access to the caller's source repository, including `Program.cs`, and its normal deployment pipeline. You do not need Azure App Configuration access to follow this article.
- Identify the caller's environment and the downstream project ID. `<downstream-project-id>` identifies the destination; the caller's `ProjectId` setting identifies the caller.
- To use the verification commands, you need a configured SAIF CLI with access to the relevant Dynatrace environment.

!!! warning "Use the normal deployment process"
    Make the correction in source control and use the caller's pipeline with its normal approvals, rollout, and rollback controls. Confirm the target app and slot and preserve existing authentication middleware. Do not manually restart apps as a workaround, copy another environment's discovery values, or hard-code a deployed URL into the client.

---

## Fix

1. **Check the caller's `Program.cs` for `UseAzureDefaults()`.** Open `Program.cs` at the commit deployed to the failing environment. Before `builder.Build()`, it should call `builder.AddAzureDefaults()` and `builder.AddServiceDefaults()`. After building the app, it should call `app.UseAzureDefaults()` before `UseServiceDefaults()`. `AddAzureDefaults()` registers App Configuration refresh, but only `UseAzureDefaults()` installs the middleware that triggers it. Without that middleware, discovery keys that the downstream service publishes after the caller starts never reach the running process.

    If `UseAzureDefaults()` is missing, add it and preserve the rest of the request pipeline. For a JWT bearer API, the relevant section should look like:

    ```csharp
    app
        .UseAzureDefaults()
        .UseServiceDefaults()
        .UseJwtBearerServices();
    ```

    This matches the [feature API template](https://github.com/saif-corp/forge/blob/main/src/templates/saif-feature-api/src/SAIF.App1/Program.cs). Do not replace a frontend's OpenID Connect middleware with JWT bearer middleware just to match this example.

    In the reported incident, the caller omitted `UseAzureDefaults()`, the downstream service's discovery keys first appeared after the caller started, and failures continued without a restart.

2. **Confirm that the downstream service has deployed to the caller's environment.** The downstream service publishes `services:<downstream-project-id>:https` and `services:<downstream-project-id>:path` when its infrastructure deployment runs for an environment. The [`saif-api-service` module](../reference/terraform/saif-api-service/index.md) always enables this through the [API module's service-discovery resources](https://github.com/saif-corp/forge/blob/main/src/terraform/saif-resources/modules/api/service_discovery.tf); a downstream that uses the `saif-resources` `api` module directly needs `enable_service_discovery = true`. Check the downstream's pipeline history for a successful infrastructure deployment to the caller's environment, or ask the downstream owner. If the downstream has not deployed there yet, wait for that deployment before you redeploy the caller.

    If someone on your team has read access to the App Configuration store, they can confirm the keys directly. You do not need this check to proceed:

    ```powershell
    az appconfig kv list --name '<app-configuration-store>' --subscription '<store-subscription-id>' --auth-mode login --key 'services:<downstream-project-id>:*' --label '<environment>' --fields key label value last_modified --output table
    ```

    Expect both keys labeled for the caller's environment, with the deployed endpoint in `https` and the APIM path in `path`. An authorization error does not mean the keys are absent. The [Azure CLI reference](https://learn.microsoft.com/en-us/cli/azure/appconfig/kv?view=azure-cli-latest#az-appconfig-kv-list) documents the key and label filters.

3. **Check the caller's environment settings if steps 1 and 2 look correct.** The caller loads keys labeled with its effective environment name from the store in `AppConfigurationEndpoint`. In the caller's deployed app settings, confirm that `ASPNETCORE_ENVIRONMENT`, and any `DOTNET_ENVIRONMENT` override, matches the environment the downstream deployed to. Confirm that `AppConfigurationEndpoint` has a value and that `ProjectId` holds the caller's own project ID. If the app customizes `AzureConfigurationOptions.Prefixes`, keep `services:*`. If you cannot view the app settings, ask the Forge platform team.

    [`SAIF.Platform.Azure`](../reference/dotnet/SAIF.Platform.Azure/index.md) loads null-labeled defaults followed by the effective environment's values, so keys under another environment label do not supply the intended override. An absent `AppConfigurationEndpoint` disables the remote configuration integration.

4. **Redeploy the corrected caller through its normal pipeline.** Deploy after the downstream service has deployed to the same environment, and confirm that the active app or slot runs the corrected version. The new process loads current configuration at startup, and the middleware lets incoming requests trigger future refresh checks. Do not use manual restarts or repeated redeploys in place of fixing the middleware, the downstream deployment, or the caller's settings.

---

## Verify

Repeat the same safe operation that made the downstream call fail, then inspect that new request's trace. Use the caller's telemetry service name for `<caller-service>`:

```powershell
saif otel traces '<caller-service>' --env '<environment>' --from 'now()-30m'
saif otel logs '<caller-service>' --env '<environment>' --level warn --from 'now()-30m'
```

Do not add `--failed` to the verification trace query: you need to see the successful request, not just an empty failure list. Confirm that the downstream operation returns its expected response and that any new connection/DNS spans use the deployed hostname rather than `<projectId>`. A reused connection might not produce a new DNS span.

No traffic, a healthy startup, or an empty failure query does not confirm recovery. The reported incident had no verified recovery request at the time of writing; the middleware correction follows the verified platform source and Microsoft guidance below.

If the logical-name DNS failure persists after deployment, confirm that the running version contains the middleware, then ask someone with App Configuration read access to run the step 2 query. If the keys exist and the failure persists, investigate configuration overrides and custom HTTP-client or service-discovery registration rather than restarting or repeatedly redeploying the app. If the call now reaches the real hostname but fails with an HTTP status, follow [deployed API diagnostics](../build/apis/calling-apis.md#troubleshooting-deployed-failures) for that separate failure.

---

## Cause

Locally, Aspire supplies service endpoints through AppHost references. In a deployed Forge API, `AddAzureDefaults()` loads `services:*` from Azure App Configuration and `AddServiceDefaults()` registers configuration-backed service discovery. If configuration supplies no endpoint, the default [pass-through resolver](https://learn.microsoft.com/en-us/dotnet/core/extensions/service-discovery#resolve-service-endpoints-using-platform-provided-service-discovery) returns the logical name as a DNS endpoint. The connection then fails if DNS cannot resolve that name. Retrying the same unresolved name does not supply the missing configuration.

The [Forge 3.9.1 Azure integration source](https://github.com/saif-corp/forge/blob/3.9.1/src/dotnet/SAIF.Platform.Azure/Extensions.cs) separates refresh registration (`ConfigureRefresh(...RegisterAll())`) from the middleware installed by `UseAzureDefaults()`. Without that middleware or another explicit refresh trigger, keys added after startup do not reach the running process through request-driven refresh. Microsoft's [dynamic configuration guidance](https://learn.microsoft.com/en-us/azure/azure-app-configuration/enable-dynamic-configuration-aspnet-core#request-driven-configuration-refresh), checked on October 16, 2026, confirms that incoming requests trigger checks, idle apps do not refresh, and the triggering request can still see the old configuration.

The .NET [configuration endpoint provider in 10.9.0](https://github.com/dotnet/extensions/blob/v10.9.0/src/Libraries/Microsoft.Extensions.ServiceDiscovery/Configuration/ConfigurationServiceEndpointProvider.cs), referenced by Forge 3.9.1, registers configuration reload tokens even when the service section is absent. That supports endpoint re-resolution after configuration reload; it cannot cause Azure App Configuration to refresh by itself. Deploying the source correction loads current configuration at startup and enables future refresh checks; this does not assume an already-created client will rebuild every captured value. See [Refresh Options at Runtime](../build/config/refresh-options-at-runtime.md).

---

## Related

- [Downstream API calls: service discovery from local to deployed](../build/apis/calling-apis.md#service-discovery-local-to-deployed)
- [`SAIF.Platform.Azure` reference](../reference/dotnet/SAIF.Platform.Azure/index.md)
- [Refresh Options at Runtime](../build/config/refresh-options-at-runtime.md)
- [Source for the refresh wiring in Forge 3.9.1](https://github.com/saif-corp/forge/blob/3.9.1/src/dotnet/SAIF.Platform.Azure/Extensions.cs)

Drafted by GitHub Copilot
