liveBook · Manning

ASPNETCORE_URLS

As explained in ASP.NET Core in Action, 3e

ASPNETCORE_URLS is an environment variable that specifies the URL or URLs on which an ASP.NET Core application listens.

ASPNETCORE_URLS is an environment variable that sets the URL or URLs where an ASP.NET Core application listens. It is especially useful when deploying outside IIS, where the application’s listening address must be configured explicitly. section 27.0 section 27.4

Set a local listening URL

Set ASPNETCORE_URLS to http://localhost:8000, then run the published application in the same command window. ASP.NET Core uses that value and listens on port 8000 locally. section 27.4

Use the value carefully because the address determines which requests the application accepts:

  • Separate multiple URLs with semicolons, such as http://localhost:5001;http://*:5002. section 27.4
  • Use localhost to accept requests only from the local computer; use * to accept requests on that port through any URL mapped to the computer. section 27.4
  • Do not use this setting to bind to one named domain; ASP.NET Core listens to requests on the port rather than filtering domain names. section 27.4
  • For an API that must reject HTTP entirely, configure only an HTTPS URL, such as https://*:5001. section 28.4.3
http://localhost:5001;http://*:5002

Compare a local-only endpoint with a wildcard endpoint in one configuration value. section 27.4

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains environment-variable lookup, multiple URLs, wildcard behavior, hostname limits, and HTTPS-only listening.
Examples
Uses localhost, wildcard, semicolon-separated URLs, and an HTTPS-only wildcard endpoint.
What it assumes
Uses configuration and environment-variable concepts while avoiding dependence on a particular web-server hostname.
What you can do after
Operate/configure ASP.NET Core listening addresses for local, multi-endpoint, wildcard, and HTTPS-only deployment scenarios.
How it connects
Connects environment variables with command-line URL arguments, hosting environments, deployment, reverse proxies, and HTTPS.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.