Skip to content

docs: Add App Model API documentation for CORS, console apps, resource naming, and networking#454

Open
Copilot wants to merge 5 commits intomainfrom
copilot/add-docs-for-app-model-api
Open

docs: Add App Model API documentation for CORS, console apps, resource naming, and networking#454
Copilot wants to merge 5 commits intomainfrom
copilot/add-docs-for-app-model-api

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Addresses gaps identified from 20K+ Discord community messages where users had no documentation for several common AppHost scenarios.

New pages

  • app-host/resource-naming.mdx — How resource names map to env vars (ConnectionStrings__<name>, services__<name>__<endpoint>__0), the dash→underscore transformation (my-serviceConnectionStrings__my_service), naming best practices (dashes preferred, underscores valid), and resource name validation rules (links to ASPIRE006 diagnostic).

  • app-host/console-apps.mdx — Adding .NET console/worker projects to AppHost via AddProject, plus links to AddExecutable, AddPythonApp, and AddNodeApp for non-.NET apps. Covers wiring service discovery on non-ASP.NET Core hosts, BackgroundService patterns, WithExplicitStart() for interactive apps, and dashboard console output.

  • app-host/cors-configuration.mdx — When CORS is (and isn't) needed with Aspire, ASP.NET Core Minimal API middleware setup with AddCors/UseCors, environment-based origins, using WithReference(frontend) to auto-inject the frontend URL into API CORS config, common failure patterns (middleware ordering, preflight, credentials), and dashboard CORS env var.

Updated pages

  • fundamentals/networking-overview.mdx — Two new sections:
    • Binding to all interfaces for LAN access — 0.0.0.0 configuration for ASP.NET Core projects, containers (clarifying WithHttpEndpoint maps ports only; the app must also bind via WithEnvironment), and executables
    • Container-to-host networking — host gateway address platform table, WithReference for automatic cross-platform host resolution, AddConnectionString for existing host services, and KnownNetworkIdentifiers

Sidebar

Added all three new pages under the AppHost section in docs.topics.ts with Japanese (ja) translations.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Discord Feedback] App Model API gaps - CORS, console apps, naming, networking</issue_title>
<issue_description>## Summary

Based on analysis of 20,415 Discord messages + 147 #help threads from the Aspire community (April 2025 - February 2026), several App Model API features lack documentation.

Missing Documentation

1. CORS Configuration (10+ questions)

Current State: Zero documentation

Customer Quotes:

"Wait.. hold on, hold on, hold on, hold on, hold on.... What? do we need to configure cors?"

"I seem to be having some CORS issues with a test deployment. Would this also have to be something I configure somewhere in my project?"

Requested Documentation:

  • When CORS configuration is needed with Aspire
  • How to configure CORS for dev vs prod
  • Common CORS issues and solutions

2. Console Application Integration (17 questions)

Customer Quotes:

"if I want to hook up a Console project with Aspire, so that it can still (maybe?) use service discovery, service defaults, etc. with Aspire resources... is that possible?"

"Colleague asked how to start a console app with aspire. I got it to connect to another resource (redis) and write a kv.... but then was wondering how to 'launch the console window' so one could interact with Console.Readline."

Requested Documentation:

  • Adding Console apps to Aspire AppHost
  • Service discovery in Console apps (non-ASP.NET Core)
  • Background worker / hosted service patterns
  • Interactive console apps with stdin/stdout

3. Resource Naming Conventions

Customer Quote:

"How does WithReference treat names that have dashes? e.g. AddWhatever("my-service") and then will it be like MY_SERVICE_[PROPERTY]? Or MY-SERVICE_[PROPERTY]?"

Requested Documentation:

  • How resource names map to environment variables
  • Dashes → underscores transformation rules
  • Best practices for naming resources

4. Network Binding (0.0.0.0 / LAN Access)

From #help thread: "How to bind services to 0.0.0.0 for LAN access?"

Requested Documentation:

  • Exposing services to external network
  • Binding to 0.0.0.0 vs localhost
  • LAN development scenarios

5. Container-to-Host Networking

Customer Quote:

"I'm struggling to get endpoints resolved in the context of a container. If I use KnownNetworkIdentifiers.LocalhostNetwork, it always comes back with localhost not host.docker.internal"

From #help: "Containers can't reach localhost SQL"

Requested Documentation:

  • host.docker.internal behavior
  • KnownNetworkIdentifiers enum usage
  • Container-to-localhost SQL Server connectivity

Data Source

  • Discord channels: #💫│general, #🔵│azure, #🔨│building-resources
  • Help threads: 147 analyzed from #🆘│help
  • Total messages: 20,415
  • Date range: April 2025 - February 2026</issue_description>

<agent_instructions>Please address this issue, while using the .github/skills/doc-writer/SKILL.md. Be certain to also take into account, related issues, pull requests, and comments that are directly linked as well as comments.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…etworking

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copilot AI changed the title [WIP] Add missing documentation for App Model API features docs: Add App Model API documentation for CORS, console apps, resource naming, and networking Feb 20, 2026
Copilot AI requested a review from IEvangelist February 20, 2026 20:55
Copy link
Member

@IEvangelist IEvangelist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good so far, but let's double check it for accuracy by using the .github/skills/doc-tester/SKILL.md skill. Please also consider all new comments and feedback. @copilot

…x code block titles, reorganize networking examples

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 20, 2026

This PR looks good so far, but let's double check it for accuracy by using the .github/skills/doc-tester/SKILL.md skill. Please also consider all new comments and feedback. @copilot

Ran the doc-tester validation on all new and updated pages. Here's what was verified:

All internal links return HTTP 200/diagnostics/aspire006/, /fundamentals/service-discovery/, /fundamentals/networking-overview/, /fundamentals/external-parameters/, /app-host/console-apps/, /app-host/cors-configuration/, /dashboard/configuration/, /dashboard/enable-browser-telemetry/, /fundamentals/service-defaults/, /app-host/executable-resources/.

Content accuracy checks:

  • KnownNetworkIdentifiers.LocalhostNetwork / .DefaultAspireContainerNetwork API signature verified against the what's-new/aspire-13.mdx reference
  • AddConnectionString usage verified against existing docs (external-parameters.mdx)
  • WaitFor, WithExplicitStart, AddRedisClient all verified as established APIs in existing docs
  • WithEnvironment(..., GetEndpoint(...)) pattern verified against resource-hierarchies.mdx

One structural fix made (commit e1a909e): An AddExecutable example was misplaced under the "For container resources" section in networking-overview.mdx — moved it to "For executable resources" where it belongs.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CommunityToolkit/Aspire
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/dotnet/aspire
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/dotnet/aspire-samples
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/microsoft/aspire.dev
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/microsoft/dcp
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/.npm/_npx/aa98e6899c6baff3/node_modules/.bin/astro dev --port 4321 | cut -d&#34; &#34; -f2 (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/../astro/astro.js dev --port 4321 (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/../astro/astro.js build .0/bin/pnpm (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Member

@IEvangelist IEvangelist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good so far, but let's double check it for accuracy by using the .github/skills/doc-tester/SKILL.md skill. Please also consider all new comments and feedback/suggestions. @copilot

…ages, add LearnMore links

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 23, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CommunityToolkit/Aspire
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/dotnet/aspire
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/dotnet/aspire-samples
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/microsoft/aspire.dev
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/microsoft/dcp
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./scripts/update-github-stats.js (http block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/../astro/astro.js build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/../astro/astro.js dev --port 4321 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from IEvangelist February 23, 2026 14:46
@IEvangelist IEvangelist marked this pull request as ready for review February 23, 2026 16:09
Copilot AI review requested due to automatic review settings February 23, 2026 16:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new AppHost documentation pages to close gaps around CORS, console/worker apps, and resource naming, and extends the networking fundamentals page with LAN binding and container-to-host guidance.

Changes:

  • Added new AppHost docs: CORS configuration, console/worker apps, and resource naming conventions.
  • Expanded networking-overview.mdx with LAN binding and container-to-host networking sections.
  • Updated the docs sidebar and refreshed the integrations catalog metadata.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/frontend/src/data/aspire-integrations.json Updates integration package versions/icons/download counts; adds new CommunityToolkit entries.
src/frontend/src/content/docs/fundamentals/networking-overview.mdx Adds LAN binding guidance and container-to-host networking + KnownNetworkIdentifiers examples.
src/frontend/src/content/docs/app-host/resource-naming.mdx New page describing env var mapping, dash→underscore behavior, and naming guidance.
src/frontend/src/content/docs/app-host/cors-configuration.mdx New page explaining when/how to configure CORS (dev/prod patterns + common issues).
src/frontend/src/content/docs/app-host/console-apps.mdx New page documenting console/worker app orchestration, service discovery, and dashboard logs.
src/frontend/config/sidebar/docs.topics.ts Adds new AppHost pages to the sidebar.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +447 to +449
// The container can reach the host-side service via the correct gateway address
var containerApp = builder.AddContainer("mycontainer", "myimage")
.WithEnvironment("HOST_URL", $"http://host.docker.internal:5000");
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says WithReference “automatically handles” container→host addressing, but the example hardcodes host.docker.internal via WithEnvironment and doesn’t use WithReference at all (and it isn’t cross-platform per the table just above). Please update the example to demonstrate the described behavior (e.g., service discovery/WithReference, or GetEndpoint(..., KnownNetworkIdentifiers.DefaultAspireContainerNetwork)) and avoid hardcoding a Docker Desktop–specific hostname.

Suggested change
// The container can reach the host-side service via the correct gateway address
var containerApp = builder.AddContainer("mycontainer", "myimage")
.WithEnvironment("HOST_URL", $"http://host.docker.internal:5000");
// Host-side project (runs on the developer machine, not in a container)
var api = builder.AddProject<Projects.Api>("api");
// The container can reach the host-side service via WithReference,
// which automatically uses the correct host gateway address for the runtime
var containerApp = builder.AddContainer("mycontainer", "myimage")
.WithReference(api);

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 4d1b8d0. The example now uses WithReference(api) to demonstrate that Aspire automatically resolves the correct host gateway address, rather than hardcoding host.docker.internal.

Comment on lines +811 to +817
{
label: 'Console and worker apps',
slug: 'app-host/console-apps',
translations: {
en: 'Console and worker apps',
},
},
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new sidebar items include only an en translation, but other items in the same AppHost section provide both en and ja. Please add ja translations for these new entries (or follow the established pattern for this section) to keep locale coverage consistent.

Copilot uses AI. Check for mistakes.
Comment on lines +153 to +160
## Resource name validation

Aspire validates resource names at startup. Valid resource names:

- Must be non-empty
- Must start with a lowercase letter
- May only contain lowercase letters, digits, and dashes (`-`)
- Must not contain consecutive dashes (`--`)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Resource name validation” rules here appear inconsistent with other docs in this repo that use underscores in resource names (for example postgres.AddDatabase("app_db") in integrations/databases/postgres/postgres-host.mdx). Please verify the actual ASPIRE006 naming constraints and align this list (and the earlier note about “dots or underscores are preserved”) so the site isn’t internally contradictory.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 4d1b8d0. Validation rules now include underscores as valid (consistent with app_db usage in the PostgreSQL docs). Also removed the contradictory "avoid underscores" best practice and updated it to note underscores are valid but dashes are preferred for consistency.

Copy link
Member

@IEvangelist IEvangelist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good so far, but let's double check it for accuracy by using the .github/skills/doc-tester/SKILL.md skill. Please also consider all new comments and feedback/suggestions. @copilot


## Adding a console app to the AppHost

Any .NET project — including console applications and Worker Service projects — can be added to the AppHost using `AddProject`. The project doesn't need to be a web app.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note, is that we support other console apps too - other than just .NET. We should really add a bit here about AddExecutable (and even provide links to AddPythonApp, and maybe AddNode*, perhaps they could just be links...but the idea is that we shouldn't isolate ourselves into just .NET. Obviously, the ServiceDefaults are only applicable to the .NET projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note and LearnMore links for AddExecutable, AddPythonApp, and AddNodeApp at the top of the "Adding a console app to the AppHost" section in commit 4d1b8d0.

…apps, naming fixes, networking accuracy

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 23, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/../astro/astro.js dev --port 4321 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discord Feedback] App Model API gaps - CORS, console apps, naming, networking

3 participants