diff --git a/.github/workflows/check-for-build-warnings.yml b/.github/workflows/check-for-build-warnings.yml index a8ed666c7b47..ef30a22af709 100644 --- a/.github/workflows/check-for-build-warnings.yml +++ b/.github/workflows/check-for-build-warnings.yml @@ -1,21 +1,25 @@ -name: 'Status checker' +name: 'OPS status checker' -on: +on: pull_request_target: types: [opened, synchronize, reopened] +permissions: + contents: read + jobs: status_checker_job: name: Look for build warnings runs-on: ubuntu-latest permissions: - statuses: write - issues: write - pull-requests: write + statuses: read + pull-requests: write steps: - - uses: actions/checkout@v3 - - uses: dotnet/docs-actions/actions/status-checker@main - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - docs_path: "aspnetcore" - url_base_path: "aspnet/core" + - name: Harden Runner + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 + with: + egress-policy: audit + + - uses: dotnet/docs-tools/actions/status-checker@455480c2e1c2fa90ecb711963250f000d66d3251 # main + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/generate-preview-links.yml b/.github/workflows/generate-preview-links.yml new file mode 100644 index 000000000000..84f913856bd4 --- /dev/null +++ b/.github/workflows/generate-preview-links.yml @@ -0,0 +1,25 @@ +name: 'Preview link generator' + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +jobs: + preview_link_generator_job: + name: Generate preview link table + runs-on: ubuntu-latest + permissions: + statuses: read + pull-requests: write + steps: + - name: Harden Runner + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 + with: + egress-policy: audit + + - uses: dotnet/docs-tools/actions/preview-link-generator@455480c2e1c2fa90ecb711963250f000d66d3251 # main + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/aspnetcore/blazor/forms/index.md b/aspnetcore/blazor/forms/index.md index 9f7d6ce931fe..8480bf336b2a 100644 --- a/aspnetcore/blazor/forms/index.md +++ b/aspnetcore/blazor/forms/index.md @@ -313,7 +313,7 @@ To disable the automatic header-based CSRF protection middleware, set the `Disab } ``` -The the `DisableCsrfProtection` configuration setting can be supplied by any configuration source, including via an environment variable (`DisableCsrfProtection=true`). +The `DisableCsrfProtection` configuration setting can be supplied by any configuration source, including via an environment variable (`DisableCsrfProtection=true`). > [!WARNING] > Disabling the automatic CSRF protection middleware removes the default header-based (`Sec-Fetch-Site`/`Origin`) protection for the entire app. Only disable it if you provide an alternative CSRF defense, such as explicitly adopting token-based antiforgery middleware by calling . diff --git a/aspnetcore/blazor/security/index.md b/aspnetcore/blazor/security/index.md index 01923fb0bf74..c908477ea874 100644 --- a/aspnetcore/blazor/security/index.md +++ b/aspnetcore/blazor/security/index.md @@ -95,7 +95,7 @@ To disable the automatic header-based CSRF protection middleware, set the `Disab } ``` -The the `DisableCsrfProtection` configuration setting can be supplied by any configuration source, including via an environment variable (`DisableCsrfProtection=true`). +The `DisableCsrfProtection` configuration setting can be supplied by any configuration source, including via an environment variable (`DisableCsrfProtection=true`). > [!WARNING] > Disabling the automatic CSRF protection middleware removes the default header-based (`Sec-Fetch-Site`/`Origin`) protection for the entire app. Only disable it if you provide an alternative CSRF defense, such as explicitly adopting token-based antiforgery middleware by calling . diff --git a/aspnetcore/blazor/tutorials/movie-database-app/part-2.md b/aspnetcore/blazor/tutorials/movie-database-app/part-2.md index 682966cacaa9..b9b3642d7004 100644 --- a/aspnetcore/blazor/tutorials/movie-database-app/part-2.md +++ b/aspnetcore/blazor/tutorials/movie-database-app/part-2.md @@ -302,7 +302,7 @@ dotnet aspnet-codegenerator blazor CRUD -dbProvider sqlite -dc BlazorWebAppMovie *CRUD* is an acronym for Create, Read, Update, and Delete. The `blazor` generator with the `CRUD` template produces create, edit, delete, details, and index components for the app. -The following table details the ASP.NET Core code generator options used in the preceding command: +The following details the ASP.NET Core code generator options used in the preceding command: * `-dbProvider`: Database provider to use. Options include `sqlserver` (default), `sqlite`, `cosmos`, `postgres`. * `-dc`: The class to use, including the namespace (`BlazorWebAppMovies.Data`). @@ -361,7 +361,7 @@ dotnet aspnet-codegenerator blazor CRUD -dbProvider sqlite -dc BlazorWebAppMovie *CRUD* is an acronym for Create, Read, Update, and Delete. The `blazor` generator with the `CRUD` template produces create, edit, delete, details, and index components for the app. -The following table details the ASP.NET Core code generator options used in the preceding command: +The following details the ASP.NET Core code generator options used in the preceding command: * `-dbProvider`: Database provider to use. Options include `sqlserver` (default), `sqlite`, `cosmos`, `postgres`. * `-dc`: The class to use, including the namespace (`BlazorWebAppMovies.Data`). diff --git a/aspnetcore/client-side/spa/angular.md b/aspnetcore/client-side/spa/angular.md index 7c38a0514ad7..d7c391485104 100644 --- a/aspnetcore/client-side/spa/angular.md +++ b/aspnetcore/client-side/spa/angular.md @@ -4,7 +4,7 @@ author: SteveSandersonMS description: Learn how to get started with the ASP.NET Core Single Page Application (SPA) project template for Angular and the Angular CLI. monikerRange: '>= aspnetcore-3.1' ms.author: wpickett -ms.date: 07/09/2025 +ms.date: 07/29/2026 ms.reviewer: stevesa uid: spa/angular --- diff --git a/aspnetcore/diagnostics/aspdepr-ids.md b/aspnetcore/diagnostics/aspdepr-ids.md index 339f296c4250..9374baf0c8fe 100644 --- a/aspnetcore/diagnostics/aspdepr-ids.md +++ b/aspnetcore/diagnostics/aspdepr-ids.md @@ -19,7 +19,7 @@ ASPDEPR diagnostics are similar to the [`SYSLIB` obsoletions](/dotnet/fundamenta ## ASPDEPR diagnostics -The following table lists the `ASPDEPR` deprecation diagnostics for ASP.NET Core: +The following table lists the `ASPDEPR` deprecation diagnostics for ASP.NET Core. | Diagnostic ID | Description | |-------------------------------------------|-----------------------------| diff --git a/aspnetcore/fundamentals/dependency-injection.md b/aspnetcore/fundamentals/dependency-injection.md index 9669d8aaf3ef..99a7cd011873 100644 --- a/aspnetcore/fundamentals/dependency-injection.md +++ b/aspnetcore/fundamentals/dependency-injection.md @@ -1092,7 +1092,7 @@ For examples of how to build modular and multitenant apps using just the Orchard The `Program` file (.NET 6 or later) or the `Startup` file (.NET 5 or earlier) registers services that the app uses, including platform features, such as Entity Framework Core and services to support Razor components in Blazor (.NET 8 or later). Initially, the `IServiceCollection` has services defined by the framework depending on [how the host was configured](xref:fundamentals/index#host). For apps based on the ASP.NET Core templates, the framework registers more than 250 services. -The following table describes a small sample of framework-registered services: +The following table describes a small sample of framework-registered services. Service type | Lifetime --- | --- diff --git a/aspnetcore/fundamentals/host/generic-host.md b/aspnetcore/fundamentals/host/generic-host.md index 0f28ab25f62d..16690af7acd4 100644 --- a/aspnetcore/fundamentals/host/generic-host.md +++ b/aspnetcore/fundamentals/host/generic-host.md @@ -4,7 +4,7 @@ author: tdykstra description: Use .NET Generic Host in ASP.NET Core apps. Generic Host is responsible for app startup and lifetime management. monikerRange: '>= aspnetcore-3.1' ms.author: tdykstra -ms.date: 04/22/2026 +ms.date: 07/29/2026 uid: fundamentals/host/generic-host # customer intent: As an ASP.NET developer, I want to explore the .NET Generic Host in ASP.NET Core, so I can configure startup and management for my web app. @@ -521,7 +521,7 @@ webBuilder.UseSetting("https_port", "8080"); :::moniker-end -:::moniker range=">= aspnetcore-6.0" +:::moniker range=">= aspnetcore-8.0" ### HTTPS ports @@ -533,11 +533,12 @@ Specifies the possible ports to listen on for HTTPS connections. **Set using**: Configuration or `UseSetting` **Environment variable**: `{PREFIX_}HTTPS_PORTS` -:::code language="csharp" source="generic-host/samples/6.x/GenericHostSample/Snippets/Program.cs" id="snippet_WebHostBuilderHttpsPorts"::: +```csharp +webBuilder.UseSetting("https_ports", "8080"); +``` :::moniker-end - ### Prefer hosting URLs Indicates whether the host should listen on the URLs configured with the `IWebHostBuilder` instead of URLs configured with the `IServer` implementation. diff --git a/aspnetcore/fundamentals/host/generic-host/samples/6.x/GenericHostSample/Snippets/Program.cs b/aspnetcore/fundamentals/host/generic-host/samples/6.x/GenericHostSample/Snippets/Program.cs index 2d544238228a..c39d686fd99b 100644 --- a/aspnetcore/fundamentals/host/generic-host/samples/6.x/GenericHostSample/Snippets/Program.cs +++ b/aspnetcore/fundamentals/host/generic-host/samples/6.x/GenericHostSample/Snippets/Program.cs @@ -98,10 +98,6 @@ public static void WebHostBuilder(WebHostBuilder webBuilder) webBuilder.UseSetting("https_port", "8080"); // - // - webBuilder.UseSetting("https_ports", "8080"); - // - // webBuilder.PreferHostingUrls(true); // diff --git a/aspnetcore/fundamentals/middleware/index.md b/aspnetcore/fundamentals/middleware/index.md index 0698c7408b9f..8f994659a96f 100644 --- a/aspnetcore/fundamentals/middleware/index.md +++ b/aspnetcore/fundamentals/middleware/index.md @@ -494,7 +494,7 @@ public class Startup } ``` -The following table shows the requests and responses from `http://localhost:1234` using the previous code: +The following table shows the requests and responses from `http://localhost:1234` using the previous code. | Request | Response | | ----------------------------- | ---------------------------- | diff --git a/aspnetcore/fundamentals/minimal-apis/includes/minimal-apis6.md b/aspnetcore/fundamentals/minimal-apis/includes/minimal-apis6.md index a7608c9d1165..1ef24d1ebe86 100644 --- a/aspnetcore/fundamentals/minimal-apis/includes/minimal-apis6.md +++ b/aspnetcore/fundamentals/minimal-apis/includes/minimal-apis6.md @@ -161,7 +161,7 @@ For more information, see ### Change the content root, app name, and environment by environment variables or command line -The following table shows the environment variable and command-line argument used to change the content root, app name, and environment: +The following table shows the environment variable and command-line argument used to change the content root, app name, and environment. | feature | Environment variable | Command-line argument | | ------------- | ------------- | -- | @@ -363,7 +363,7 @@ app.MapGet("/posts/{slug:regex(^[a-z0-9_-]+$)}", (string slug) => $"Post {slug}" app.Run(); ``` -The following table demonstrates the preceding route templates and their behavior: +The following table demonstrates the preceding route templates and their behavior. | Route Template | Example Matching URI | |--|--| diff --git a/aspnetcore/fundamentals/minimal-apis/includes/route-handlers.md b/aspnetcore/fundamentals/minimal-apis/includes/route-handlers.md index e77751788ecc..b2405073e47e 100644 --- a/aspnetcore/fundamentals/minimal-apis/includes/route-handlers.md +++ b/aspnetcore/fundamentals/minimal-apis/includes/route-handlers.md @@ -85,7 +85,7 @@ app.MapGet("/posts/{slug:regex(^[a-z0-9_-]+$)}", (string slug) => $"Post {slug}" app.Run(); ``` -The following table demonstrates the preceding route templates and their behavior: +The following table demonstrates the preceding route templates and their behavior. | Route template | Example matching URI | |---|---| diff --git a/aspnetcore/fundamentals/minimal-apis/includes/webapplication10.md b/aspnetcore/fundamentals/minimal-apis/includes/webapplication10.md index 96c88bd2e71a..458058be53b4 100644 --- a/aspnetcore/fundamentals/minimal-apis/includes/webapplication10.md +++ b/aspnetcore/fundamentals/minimal-apis/includes/webapplication10.md @@ -1,5 +1,5 @@ - :::moniker range=">= aspnetcore-10.0" + ## `WebApplication` The following code is generated by an ASP.NET Core template: @@ -12,15 +12,15 @@ The following code creates a [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_create)] -[`WebApplication.Create`](xref:Microsoft.AspNetCore.Builder.WebApplication.Create%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults: -[!INCLUDE [webapplication7](~/fundamentals/minimal-apis/includes/middleware7.md)] +[!INCLUDE[](~/fundamentals/minimal-apis/includes/middleware7.md)] ### Working with ports When a web app is created with Visual Studio or `dotnet new`, a `Properties/launchSettings.json` file is created that specifies the ports the app responds to. In the port setting samples that follow, running the app from Visual Studio returns an error dialog `Unable to connect to web server 'AppName'`. Visual Studio returns an error because it's expecting the port specified in `Properties/launchSettings.json`, but the app is using the port specified by `app.Run("http://localhost:3000")`. Run the following port changing samples from the command line. -The following sections set the port the app responds to. +The following sections set the app's port. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_p1)] @@ -28,7 +28,7 @@ In the preceding code, the app responds to port `3000`. #### Multiple ports -In the following code, the app responds to port `3000` and `4000`. +In the following code, the app responds to port `3000` and `4000`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_pm)] @@ -50,7 +50,7 @@ The following code reads the port from the environment: The preferred way to set the port from the environment is to use the `ASPNETCORE_URLS` environment variable, which is shown in the following section. -#### Set the ports via the ASPNETCORE_URLS environment variable +#### Set the ports via the `ASPNETCORE_URLS` environment variable The `ASPNETCORE_URLS` environment variable is available to set the port: @@ -66,13 +66,13 @@ ASPNETCORE_URLS=http://localhost:3000;https://localhost:5000 ### Listen on all interfaces -The following samples demonstrate listening on all interfaces +The following samples demonstrate listening on all interfaces. -#### http://*:3000 +#### `http://*:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i1)] -#### http://+:3000 +#### `http://+:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ip)] @@ -80,24 +80,27 @@ The following samples demonstrate listening on all interfaces [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i0)] -### Listen on all interfaces using ASPNETCORE_URLS +### Listen on all interfaces using `ASPNETCORE_URLS` -The preceding samples can use `ASPNETCORE_URLS` +The preceding samples can use `ASPNETCORE_URLS`: ``` ASPNETCORE_URLS=http://*:3000;https://+:5000;http://0.0.0.0:5005 ``` -### Listen on all interfaces using ASPNETCORE_HTTPS_PORTS +### Listen on all interfaces using `ASPNETCORE_HTTP_PORTS` and `ASPNETCORE_HTTPS_PORTS` -The preceding samples can use `ASPNETCORE_HTTPS_PORTS` and `ASPNETCORE_HTTP_PORTS`. +The preceding samples can also use `ASPNETCORE_HTTP_PORTS` and `ASPNETCORE_HTTPS_PORTS`, but `ASPNETCORE_URLS` (when set) overrides the following settings: ``` ASPNETCORE_HTTP_PORTS=3000;5005 ASPNETCORE_HTTPS_PORTS=5000 ``` -For more information, see [Configure endpoints for the ASP.NET Core Kestrel web server](xref:fundamentals/servers/kestrel/endpoints) +For more information, see . + +> [!NOTE] +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). ### Specify HTTPS with development certificate @@ -125,7 +128,7 @@ The following sections show how to specify the custom certificate using the `app [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_re)] -For more information using the environment, see +For more information using the environment, see . ### Configuration @@ -133,7 +136,7 @@ The following code reads from the configuration system: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_config)] -For more information, see +For more information, see . ### Logging @@ -141,7 +144,7 @@ The following code writes a message to the log on application startup: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_log)] -For more information, see +For more information, see . ### Access the Dependency Injection (DI) container @@ -149,13 +152,13 @@ The following code shows how to get services from the DI container during applic [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_dependencies)] -The following code shows how to access keys from the DI container using the [`[FromKeyedServices]`](xref:Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute) attribute: +The following code shows how to access keys from the DI container using the [`[FromKeyedServices]` attribute](xref:Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute): :::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/minimal-apis/samples/KeyServiceMinAPI/Program.cs" ::: For more information on DI, see . -## WebApplicationBuilder +## `WebApplicationBuilder` This section contains sample code using . @@ -165,35 +168,25 @@ The following code sets the content root, application name, and environment: [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_root)] -[WebApplication.CreateBuilder](xref:Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults. For more information, see ### Change the content root, app name, and environment by using environment variables or command line -The following table shows the environment variable and command-line argument used to change the content root, app name, and environment: +The following table shows the environment variable and command-line argument used to change the content root, app name, and environment. -| feature | Environment variable | Command-line argument | -| ------------- | ------------- | -- | -| Application name | ASPNETCORE_APPLICATIONNAME | --applicationName | -| Environment name | ASPNETCORE_ENVIRONMENT | --environment | -| Content root | ASPNETCORE_CONTENTROOT | --contentRoot | +| Feature | Environment variable | Command-line argument | +| --- | --- | --- | +| Application name | `ASPNETCORE_APPLICATIONNAME` | `--applicationName` | +| Environment name | `ASPNETCORE_ENVIRONMENT` | `--environment` | +| Content root | `ASPNETCORE_CONTENTROOT` | `--contentRoot` | ### Add configuration providers The following sample adds the INI configuration provider: -```csharp -var builder = WebApplication.CreateBuilder(args); - -builder.Configuration.AddIniFile("appsettings.ini"); - -var app = builder.Build(); -``` - - For detailed information, see [File configuration providers](xref:fundamentals/configuration/index#file-configuration-provider) in . @@ -223,15 +216,15 @@ The following code reads `HelloKey` from configuration and displays the value at [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_svc)] -### Customize the IHostBuilder +### Customize the `IHostBuilder` Existing extension methods on can be accessed using the [Host property](xref:Microsoft.Extensions.Hosting.IHostBuilder.Properties): [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ihb)] -### Customize the IWebHostBuilder +### Customize the `IWebHostBuilder` -Extension methods on can be accessed using the [WebApplicationBuilder.WebHost](xref:Microsoft.AspNetCore.Builder.WebApplicationBuilder.WebHost) property. +Extension methods on can be accessed using the property. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_iwhb)] @@ -263,7 +256,7 @@ Any existing ASP.NET Core middleware can be configured on the `WebApplication`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_addmid)] -For more information, see +For more information, see . ### Developer exception page diff --git a/aspnetcore/fundamentals/minimal-apis/includes/webapplication7.md b/aspnetcore/fundamentals/minimal-apis/includes/webapplication7.md index 7935199711f7..2d61f36e10b7 100644 --- a/aspnetcore/fundamentals/minimal-apis/includes/webapplication7.md +++ b/aspnetcore/fundamentals/minimal-apis/includes/webapplication7.md @@ -1,4 +1,5 @@ :::moniker range="= aspnetcore-7.0" + ## `WebApplication` The following code is generated by an ASP.NET Core template: @@ -11,15 +12,15 @@ The following code creates a [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_create)] -[`WebApplication.Create`](xref:Microsoft.AspNetCore.Builder.WebApplication.Create%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults: -[!INCLUDE [webapplication7](~/fundamentals/minimal-apis/includes/middleware7.md)] +[!INCLUDE[](~/fundamentals/minimal-apis/includes/middleware7.md)] ### Working with ports When a web app is created with Visual Studio or `dotnet new`, a `Properties/launchSettings.json` file is created that specifies the ports the app responds to. In the port setting samples that follow, running the app from Visual Studio returns an error dialog `Unable to connect to web server 'AppName'`. Visual Studio returns an error because it's expecting the port specified in `Properties/launchSettings.json`, but the app is using the port specified by `app.Run("http://localhost:3000")`. Run the following port changing samples from the command line. -The following sections set the port the app responds to. +The following sections set the app's port. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_p1)] @@ -27,7 +28,7 @@ In the preceding code, the app responds to port `3000`. #### Multiple ports -In the following code, the app responds to port `3000` and `4000`. +In the following code, the app responds to port `3000` and `4000`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_pm)] @@ -49,7 +50,7 @@ The following code reads the port from the environment: The preferred way to set the port from the environment is to use the `ASPNETCORE_URLS` environment variable, which is shown in the following section. -#### Set the ports via the ASPNETCORE_URLS environment variable +#### Set the ports via the `ASPNETCORE_URLS` environment variable The `ASPNETCORE_URLS` environment variable is available to set the port: @@ -63,17 +64,17 @@ ASPNETCORE_URLS=http://localhost:3000 ASPNETCORE_URLS=http://localhost:3000;https://localhost:5000 ``` -For more information using the environment, see +For more information using the environment, see . ### Listen on all interfaces The following samples demonstrate listening on all interfaces -#### http://*:3000 +#### `http://*:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i1)] -#### http://+:3000 +#### `http://+:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ip)] @@ -81,9 +82,9 @@ The following samples demonstrate listening on all interfaces [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i0)] -### Listen on all interfaces using ASPNETCORE_URLS +### Listen on all interfaces using `ASPNETCORE_URLS` -The preceding samples can use `ASPNETCORE_URLS` +The preceding samples can use `ASPNETCORE_URLS`: ``` ASPNETCORE_URLS=http://*:3000;https://+:5000;http://0.0.0.0:5005 @@ -117,7 +118,7 @@ The following code reads from the configuration system: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_CONFIG)] -For more information, see +For more information, see . ### Logging @@ -125,7 +126,7 @@ The following code writes a message to the log on application startup: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_log)] -For more information, see +For more information, see . ### Access the Dependency Injection (DI) container @@ -135,7 +136,7 @@ The following code shows how to get services from the DI container during applic For more information, see . -## WebApplicationBuilder +## `WebApplicationBuilder` This section contains sample code using . @@ -145,35 +146,25 @@ The following code sets the content root, application name, and environment: [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_root)] -[WebApplication.CreateBuilder](xref:Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults. -For more information, see +For more information, see . ### Change the content root, app name, and environment by environment variables or command line -The following table shows the environment variable and command-line argument used to change the content root, app name, and environment: +The following table shows the environment variable and command-line argument used to change the content root, app name, and environment. -| feature | Environment variable | Command-line argument | -| ------------- | ------------- | -- | -| Application name | ASPNETCORE_APPLICATIONNAME | --applicationName | -| Environment name | ASPNETCORE_ENVIRONMENT | --environment | -| Content root | ASPNETCORE_CONTENTROOT | --contentRoot | +| Feature | Environment variable | Command-line argument | +| --- | --- | --- | +| Application name | `ASPNETCORE_APPLICATIONNAME` | `--applicationName` | +| Environment name | `ASPNETCORE_ENVIRONMENT` | `--environment` | +| Content root | `ASPNETCORE_CONTENTROOT` | `--contentRoot` | ### Add configuration providers The following sample adds the INI configuration provider: -```csharp -var builder = WebApplication.CreateBuilder(args); - -builder.Configuration.AddIniFile("appsettings.ini"); - -var app = builder.Build(); -``` - - For detailed information, see [File configuration providers](xref:fundamentals/configuration/index#file-configuration-provider) in . @@ -189,7 +180,7 @@ The following code reads `HelloKey` from configuration and displays the value at [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_configb)] -For a complete list of configuration sources read, see [Default configuration](xref:fundamentals/configuration/index#default-configuration) in +For a complete list of configuration sources read, see [Default configuration](xref:fundamentals/configuration/index#default-configuration) in . ### Add logging providers @@ -199,15 +190,15 @@ For a complete list of configuration sources read, see [Default configuration](x [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_svc)] -### Customize the IHostBuilder +### Customize the `IHostBuilder` Existing extension methods on can be accessed using the [Host property](xref:Microsoft.Extensions.Hosting.IHostBuilder.Properties): [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ihb)] -### Customize the IWebHostBuilder +### Customize the `IWebHostBuilder` -Extension methods on can be accessed using the [WebApplicationBuilder.WebHost](xref:Microsoft.AspNetCore.Builder.WebApplicationBuilder.WebHost) property. +Extension methods on can be accessed using the property. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_iwhb)] @@ -239,7 +230,7 @@ Any existing ASP.NET Core middleware can be configured on the `WebApplication`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_addmid)] -For more information, see +For more information, see . ### Developer exception page diff --git a/aspnetcore/fundamentals/minimal-apis/includes/webapplication8.md b/aspnetcore/fundamentals/minimal-apis/includes/webapplication8.md index 5a46f19ee1c2..6dce2d3ba317 100644 --- a/aspnetcore/fundamentals/minimal-apis/includes/webapplication8.md +++ b/aspnetcore/fundamentals/minimal-apis/includes/webapplication8.md @@ -1,5 +1,5 @@ - :::moniker range="= aspnetcore-8.0" + ## `WebApplication` The following code is generated by an ASP.NET Core template: @@ -12,15 +12,15 @@ The following code creates a [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_create)] -[`WebApplication.Create`](xref:Microsoft.AspNetCore.Builder.WebApplication.Create%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults: -[!INCLUDE [webapplication7](~/fundamentals/minimal-apis/includes/middleware7.md)] +[!INCLUDE[](~/fundamentals/minimal-apis/includes/middleware7.md)] ### Working with ports When a web app is created with Visual Studio or `dotnet new`, a `Properties/launchSettings.json` file is created that specifies the ports the app responds to. In the port setting samples that follow, running the app from Visual Studio returns an error dialog `Unable to connect to web server 'AppName'`. Visual Studio returns an error because it's expecting the port specified in `Properties/launchSettings.json`, but the app is using the port specified by `app.Run("http://localhost:3000")`. Run the following port changing samples from the command line. -The following sections set the port the app responds to. +The following sections set the app's port. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_p1)] @@ -28,7 +28,7 @@ In the preceding code, the app responds to port `3000`. #### Multiple ports -In the following code, the app responds to port `3000` and `4000`. +In the following code, the app responds to port `3000` and `4000`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_pm)] @@ -50,7 +50,7 @@ The following code reads the port from the environment: The preferred way to set the port from the environment is to use the `ASPNETCORE_URLS` environment variable, which is shown in the following section. -#### Set the ports via the ASPNETCORE_URLS environment variable +#### Set the ports via the `ASPNETCORE_URLS` environment variable The `ASPNETCORE_URLS` environment variable is available to set the port: @@ -66,13 +66,13 @@ ASPNETCORE_URLS=http://localhost:3000;https://localhost:5000 ### Listen on all interfaces -The following samples demonstrate listening on all interfaces +The following samples demonstrate listening on all interfaces. -#### http://*:3000 +#### `http://*:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i1)] -#### http://+:3000 +#### `http://+:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ip)] @@ -80,24 +80,27 @@ The following samples demonstrate listening on all interfaces [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i0)] -### Listen on all interfaces using ASPNETCORE_URLS +### Listen on all interfaces using `ASPNETCORE_URLS` -The preceding samples can use `ASPNETCORE_URLS` +The preceding samples can use `ASPNETCORE_URLS`: ``` ASPNETCORE_URLS=http://*:3000;https://+:5000;http://0.0.0.0:5005 ``` -### Listen on all interfaces using ASPNETCORE_HTTPS_PORTS +### Listen on all interfaces using `ASPNETCORE_HTTP_PORTS` and `ASPNETCORE_HTTPS_PORTS` -The preceding samples can use `ASPNETCORE_HTTPS_PORTS` and `ASPNETCORE_HTTP_PORTS`. +The preceding samples can also use `ASPNETCORE_HTTP_PORTS` and `ASPNETCORE_HTTPS_PORTS`, but `ASPNETCORE_URLS` (when set) overrides the following settings: ``` ASPNETCORE_HTTP_PORTS=3000;5005 ASPNETCORE_HTTPS_PORTS=5000 ``` -For more information, see [Configure endpoints for the ASP.NET Core Kestrel web server](xref:fundamentals/servers/kestrel/endpoints) +For more information, see . + +> [!NOTE] +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). ### Specify HTTPS with development certificate @@ -125,7 +128,7 @@ The following sections show how to specify the custom certificate using the `app [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_re)] -For more information using the environment, see +For more information using the environment, see . ### Configuration @@ -133,7 +136,7 @@ The following code reads from the configuration system: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_config)] -For more information, see +For more information, see . ### Logging @@ -141,7 +144,7 @@ The following code writes a message to the log on application startup: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_log)] -For more information, see +For more information, see . ### Access the Dependency Injection (DI) container @@ -149,13 +152,13 @@ The following code shows how to get services from the DI container during applic [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_dependencies)] -The following code shows how to access keys from the DI container using the [`[FromKeyedServices]`](xref:Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute) attribute: +The following code shows how to access keys from the DI container using the [`[FromKeyedServices]` attribute](xref:Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute): :::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/minimal-apis/samples/KeyServiceMinAPI/Program.cs" ::: For more information on DI, see . -## WebApplicationBuilder +## `WebApplicationBuilder` This section contains sample code using . @@ -165,35 +168,25 @@ The following code sets the content root, application name, and environment: [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_root)] -[WebApplication.CreateBuilder](xref:Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults. For more information, see ### Change the content root, app name, and environment by using environment variables or command line -The following table shows the environment variable and command-line argument used to change the content root, app name, and environment: +The following table shows the environment variable and command-line argument used to change the content root, app name, and environment. -| feature | Environment variable | Command-line argument | -| ------------- | ------------- | -- | -| Application name | ASPNETCORE_APPLICATIONNAME | --applicationName | -| Environment name | ASPNETCORE_ENVIRONMENT | --environment | -| Content root | ASPNETCORE_CONTENTROOT | --contentRoot | +| Feature | Environment variable | Command-line argument | +| --- | --- | --- | +| Application name | `ASPNETCORE_APPLICATIONNAME` | `--applicationName` | +| Environment name | `ASPNETCORE_ENVIRONMENT` | `--environment` | +| Content root | `ASPNETCORE_CONTENTROOT` | `--contentRoot` | ### Add configuration providers The following sample adds the INI configuration provider: -```csharp -var builder = WebApplication.CreateBuilder(args); - -builder.Configuration.AddIniFile("appsettings.ini"); - -var app = builder.Build(); -``` - - For detailed information, see [File configuration providers](xref:fundamentals/configuration/index#file-configuration-provider) in . @@ -223,15 +216,15 @@ The following code reads `HelloKey` from configuration and displays the value at [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_svc)] -### Customize the IHostBuilder +### Customize the `IHostBuilder` Existing extension methods on can be accessed using the [Host property](xref:Microsoft.Extensions.Hosting.IHostBuilder.Properties): [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ihb)] -### Customize the IWebHostBuilder +### Customize the `IWebHostBuilder` -Extension methods on can be accessed using the [WebApplicationBuilder.WebHost](xref:Microsoft.AspNetCore.Builder.WebApplicationBuilder.WebHost) property. +Extension methods on can be accessed using the property. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_iwhb)] @@ -263,7 +256,7 @@ Any existing ASP.NET Core middleware can be configured on the `WebApplication`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_addmid)] -For more information, see +For more information, see . ### Developer exception page diff --git a/aspnetcore/fundamentals/minimal-apis/includes/webapplication9.md b/aspnetcore/fundamentals/minimal-apis/includes/webapplication9.md index 8c55be330c95..3189dd59cf9e 100644 --- a/aspnetcore/fundamentals/minimal-apis/includes/webapplication9.md +++ b/aspnetcore/fundamentals/minimal-apis/includes/webapplication9.md @@ -1,5 +1,5 @@ - :::moniker range="= aspnetcore-9.0" + ## `WebApplication` The following code is generated by an ASP.NET Core template: @@ -12,15 +12,15 @@ The following code creates a [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_create)] -[`WebApplication.Create`](xref:Microsoft.AspNetCore.Builder.WebApplication.Create%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults: -[!INCLUDE [webapplication7](~/fundamentals/minimal-apis/includes/middleware7.md)] +[!INCLUDE[](~/fundamentals/minimal-apis/includes/middleware7.md)] ### Working with ports When a web app is created with Visual Studio or `dotnet new`, a `Properties/launchSettings.json` file is created that specifies the ports the app responds to. In the port setting samples that follow, running the app from Visual Studio returns an error dialog `Unable to connect to web server 'AppName'`. Visual Studio returns an error because it's expecting the port specified in `Properties/launchSettings.json`, but the app is using the port specified by `app.Run("http://localhost:3000")`. Run the following port changing samples from the command line. -The following sections set the port the app responds to. +The following sections set the app's port. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_p1)] @@ -28,7 +28,7 @@ In the preceding code, the app responds to port `3000`. #### Multiple ports -In the following code, the app responds to port `3000` and `4000`. +In the following code, the app responds to port `3000` and `4000`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_pm)] @@ -50,7 +50,7 @@ The following code reads the port from the environment: The preferred way to set the port from the environment is to use the `ASPNETCORE_URLS` environment variable, which is shown in the following section. -#### Set the ports via the ASPNETCORE_URLS environment variable +#### Set the ports via the `ASPNETCORE_URLS` environment variable The `ASPNETCORE_URLS` environment variable is available to set the port: @@ -68,11 +68,11 @@ ASPNETCORE_URLS=http://localhost:3000;https://localhost:5000 The following samples demonstrate listening on all interfaces -#### http://*:3000 +#### `http://*:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i1)] -#### http://+:3000 +#### `http://+:3000` [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ip)] @@ -80,24 +80,27 @@ The following samples demonstrate listening on all interfaces [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_i0)] -### Listen on all interfaces using ASPNETCORE_URLS +### Listen on all interfaces using `ASPNETCORE_URLS` -The preceding samples can use `ASPNETCORE_URLS` +The preceding samples can use `ASPNETCORE_URLS`: ``` ASPNETCORE_URLS=http://*:3000;https://+:5000;http://0.0.0.0:5005 ``` -### Listen on all interfaces using ASPNETCORE_HTTPS_PORTS +### Listen on all interfaces using `ASPNETCORE_HTTP_PORTS` and `ASPNETCORE_HTTPS_PORTS` -The preceding samples can use `ASPNETCORE_HTTPS_PORTS` and `ASPNETCORE_HTTP_PORTS`. +The preceding samples can also use `ASPNETCORE_HTTP_PORTS` and `ASPNETCORE_HTTPS_PORTS`, but `ASPNETCORE_URLS` (when set) overrides the following settings: ``` ASPNETCORE_HTTP_PORTS=3000;5005 ASPNETCORE_HTTPS_PORTS=5000 ``` -For more information, see [Configure endpoints for the ASP.NET Core Kestrel web server](xref:fundamentals/servers/kestrel/endpoints) +For more information, see . + +> [!NOTE] +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). ### Specify HTTPS with development certificate @@ -125,7 +128,7 @@ The following sections show how to specify the custom certificate using the `app [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_re)] -For more information using the environment, see +For more information using the environment, see . ### Configuration @@ -133,7 +136,7 @@ The following code reads from the configuration system: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_config)] -For more information, see +For more information, see . ### Logging @@ -141,7 +144,7 @@ The following code writes a message to the log on application startup: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_log)] -For more information, see +For more information, see . ### Access the Dependency Injection (DI) container @@ -149,13 +152,13 @@ The following code shows how to get services from the DI container during applic [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_dependencies)] -The following code shows how to access keys from the DI container using the [`[FromKeyedServices]`](xref:Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute) attribute: +The following code shows how to access keys from the DI container using the [`[FromKeyedServices]` attribute](xref:Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute): :::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/minimal-apis/samples/KeyServiceMinAPI/Program.cs" ::: For more information on DI, see . -## WebApplicationBuilder +## `WebApplicationBuilder` This section contains sample code using . @@ -165,35 +168,25 @@ The following code sets the content root, application name, and environment: [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_root)] -[WebApplication.CreateBuilder](xref:Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder%2A) initializes a new instance of the class with preconfigured defaults. + initializes a new instance of the class with preconfigured defaults. For more information, see ### Change the content root, app name, and environment by using environment variables or command line -The following table shows the environment variable and command-line argument used to change the content root, app name, and environment: +The following table shows the environment variable and command-line argument used to change the content root, app name, and environment. -| feature | Environment variable | Command-line argument | -| ------------- | ------------- | -- | -| Application name | ASPNETCORE_APPLICATIONNAME | --applicationName | -| Environment name | ASPNETCORE_ENVIRONMENT | --environment | -| Content root | ASPNETCORE_CONTENTROOT | --contentRoot | +| Feature | Environment variable | Command-line argument | +| --- | --- | --- | +| Application name | `ASPNETCORE_APPLICATIONNAME` | `--applicationName` | +| Environment name | `ASPNETCORE_ENVIRONMENT` | `--environment` | +| Content root | `ASPNETCORE_CONTENTROOT` | `--contentRoot` | ### Add configuration providers The following sample adds the INI configuration provider: -```csharp -var builder = WebApplication.CreateBuilder(args); - -builder.Configuration.AddIniFile("appsettings.ini"); - -var app = builder.Build(); -``` - - For detailed information, see [File configuration providers](xref:fundamentals/configuration/index#file-configuration-provider) in . @@ -223,15 +216,15 @@ The following code reads `HelloKey` from configuration and displays the value at [!code-csharp[](~/migration/50-to-60-samples/samples/Web6Samples/Program.cs?name=snippet_svc)] -### Customize the IHostBuilder +### Customize the `IHostBuilder` Existing extension methods on can be accessed using the [Host property](xref:Microsoft.Extensions.Hosting.IHostBuilder.Properties): [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_ihb)] -### Customize the IWebHostBuilder +### Customize the `IWebHostBuilder` -Extension methods on can be accessed using the [WebApplicationBuilder.WebHost](xref:Microsoft.AspNetCore.Builder.WebApplicationBuilder.WebHost) property. +Extension methods on can be accessed using the property. [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_iwhb)] @@ -263,7 +256,7 @@ Any existing ASP.NET Core middleware can be configured on the `WebApplication`: [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_addmid)] -For more information, see +For more information, see . ### Developer exception page diff --git a/aspnetcore/fundamentals/native-aot.md b/aspnetcore/fundamentals/native-aot.md index 1db15d344532..5122ab20d7a5 100644 --- a/aspnetcore/fundamentals/native-aot.md +++ b/aspnetcore/fundamentals/native-aot.md @@ -46,7 +46,7 @@ For ASP.NET Core Blazor WebAssembly Native AOT guidance, which adds to or supers Not all features in ASP.NET Core are currently compatible with Native AOT. -The following table summarizes ASP.NET Core feature compatibility with Native AOT: +The following table summarizes ASP.NET Core feature compatibility with Native AOT. | Feature | Supported | Partial support | Not supported | |---|:---:|:---:|:---:| diff --git a/aspnetcore/fundamentals/native-aot/includes/native-aot8.md b/aspnetcore/fundamentals/native-aot/includes/native-aot8.md index 908a6c73f64e..d103994995b2 100644 --- a/aspnetcore/fundamentals/native-aot/includes/native-aot8.md +++ b/aspnetcore/fundamentals/native-aot/includes/native-aot8.md @@ -22,7 +22,7 @@ The preceding chart shows that Native AOT has lower app size, memory usage, and ## ASP.NET Core and Native AOT compatibility -Not all features in ASP.NET Core are currently compatible with Native AOT. The following table summarizes ASP.NET Core feature compatibility with Native AOT: +Not all features in ASP.NET Core are currently compatible with Native AOT. The following table summarizes ASP.NET Core feature compatibility with Native AOT. | Feature | Fully Supported | Partially Supported | Not Supported | | - | - | - | - | diff --git a/aspnetcore/fundamentals/openapi/include-metadata.md b/aspnetcore/fundamentals/openapi/include-metadata.md index 4bacf69aee2e..c8ff769fb448 100644 --- a/aspnetcore/fundamentals/openapi/include-metadata.md +++ b/aspnetcore/fundamentals/openapi/include-metadata.md @@ -599,7 +599,7 @@ When the property i #### String types -The following table shows how C# types map to `string` type properties in the generated OpenAPI document: +The following table shows how C# types map to `string` type properties in the generated OpenAPI document. | C# Type | OpenAPI `type` | OpenAPI `format` | Other assertions | | -------------- | -------------- | ---------------- | ------------------------------ | @@ -614,7 +614,7 @@ The following table shows how C# types map to `string` type properties in the ge #### Other types -Other C# types are represented in the generated OpenAPI document as shown in the following table: +Other C# types are represented in the generated OpenAPI document as shown in the following table. | C# Type | OpenAPI `type` | OpenAPI `format` | | -------------- | -------------- | ---------------- | @@ -626,7 +626,7 @@ Other C# types are represented in the generated OpenAPI document as shown in the ASP.NET uses metadata from attributes on class or record properties to set metadata on the corresponding properties of the generated schema. -The following table summarizes attributes from the `System.ComponentModel` namespace that provide metadata for the generated schema: +The following table summarizes attributes from the `System.ComponentModel` namespace that provide metadata for the generated schema. | Attribute | Description | | ---------------------------- | ----------- | @@ -749,7 +749,7 @@ The following code configures some JSON options globally, for Minimal APIs and C ## MVC JSON options and global JSON options -The following table shows the key differences beween the MVC JSON options and global Minimal API JSON options: +The following table shows the key differences between the MVC JSON options and global Minimal API JSON options. | **Aspect** | **MVC JSON Options** | **Global JSON Options** | |-----------------------|--------------------------------------------|-----------------------------------------------| diff --git a/aspnetcore/fundamentals/openapi/includes/api_endpoint_operation.md b/aspnetcore/fundamentals/openapi/includes/api_endpoint_operation.md index 3e8d16efe381..bbdb83b2d294 100644 --- a/aspnetcore/fundamentals/openapi/includes/api_endpoint_operation.md +++ b/aspnetcore/fundamentals/openapi/includes/api_endpoint_operation.md @@ -79,7 +79,7 @@ json{ ## API, API operation, and API endpoint comparison -The following table summarizes the differences between an API, an API operation, and an API endpoint: +The following table summarizes the differences between an API, an API operation, and an API endpoint. | Concept | API Operation | API Endpoint | |-----------------|----------------------------------------------------|--------------------------------------------------| diff --git a/aspnetcore/fundamentals/openapi/includes/include-metadata10.md b/aspnetcore/fundamentals/openapi/includes/include-metadata10.md index bd79d4b3cfc6..af443858586e 100644 --- a/aspnetcore/fundamentals/openapi/includes/include-metadata10.md +++ b/aspnetcore/fundamentals/openapi/includes/include-metadata10.md @@ -531,7 +531,7 @@ When the property i #### String types -The following table shows how C# types map to `string` type properties in the generated OpenAPI document: +The following table shows how C# types map to `string` type properties in the generated OpenAPI document. | C# Type | OpenAPI `type` | OpenAPI `format` | Other assertions | | -------------- | -------------- | ---------------- | ------------------------------ | @@ -558,7 +558,7 @@ Other C# types are represented in the generated OpenAPI document as shown in the ASP.NET uses metadata from attributes on class or record properties to set metadata on the corresponding properties of the generated schema. -The following table summarizes attributes from the `System.ComponentModel` namespace that provide metadata for the generated schema: +The following table summarizes attributes from the `System.ComponentModel` namespace that provide metadata for the generated schema. | Attribute | Description | | ---------------------------- | ----------- | @@ -681,7 +681,7 @@ The following code configures some JSON options globally, for Minimal APIs and C ## MVC JSON options and global JSON options -The following table shows the key differences beween the MVC JSON options and global Minimal API JSON options: +The following table shows the key differences between the MVC JSON options and global Minimal API JSON options. | **Aspect** | **MVC JSON Options** | **Global JSON Options** | |-----------------------|--------------------------------------------|-----------------------------------------------| diff --git a/aspnetcore/fundamentals/openapi/includes/include-metadata9.md b/aspnetcore/fundamentals/openapi/includes/include-metadata9.md index a83db707b8a1..19d078c00e80 100644 --- a/aspnetcore/fundamentals/openapi/includes/include-metadata9.md +++ b/aspnetcore/fundamentals/openapi/includes/include-metadata9.md @@ -479,7 +479,7 @@ The `type` and `format` can also be set with a [Schema Transformer](xref:fundame ASP.NET uses metadata from attributes on class or record properties to set metadata on the corresponding properties of the generated schema. -The following table summarizes attributes from the `System.ComponentModel` namespace that provide metadata for the generated schema: +The following table summarizes attributes from the `System.ComponentModel` namespace that provide metadata for the generated schema. | Attribute | Description | | ---------------------------- | ----------- | diff --git a/aspnetcore/fundamentals/routing.md b/aspnetcore/fundamentals/routing.md index 874950ee9110..72a8cff5cd80 100644 --- a/aspnetcore/fundamentals/routing.md +++ b/aspnetcore/fundamentals/routing.md @@ -442,7 +442,7 @@ The constraint name and arguments are passed to the [!WARNING] > Don't use constraints for input validation. If constraints are used for input validation, invalid input results in a `404` Not Found response. Invalid input should produce a `400` Bad Request with an appropriate error message. Route constraints are used to disambiguate similar routes, not to validate the inputs for a particular route. -The following table demonstrates example route constraints and their expected behavior: +The following table demonstrates example route constraints and their expected behavior. | constraint | Example | Example Matches | Notes | |---------------------|---------------------------------------------|----------------------------------------|-------------------------------------------------------------------------------------------| @@ -534,14 +534,14 @@ Regular expressions use delimiters and tokens similar to those used by routing a * Replace `\` characters provided in the string as `\\` characters in the C# source file in order to escape the `\` string escape character. * [Verbatim string literals](/dotnet/csharp/language-reference/keywords/string). -To escape routing parameter delimiter characters `{`, `}`, `[`, `]`, double the characters in the expression, for example, `{{`, `}}`, `[[`, `]]`. The following table shows a regular expression and its escaped version: +To escape routing parameter delimiter characters `{`, `}`, `[`, `]`, double the characters in the expression, for example, `{{`, `}}`, `[[`, `]]`. The following table shows a regular expression and its escaped version. | Regular expression | Escaped regular expression | | --------------------- | ------------------------------ | | `^\d{3}-\d{2}-\d{4}$` | `^\\d{{3}}-\\d{{2}}-\\d{{4}}$` | | `^[a-z]{2}$` | `^[[a-z]]{{2}}$` | -Regular expressions used in routing often start with the `^` character and match the starting position of the string. The expressions often end with the `$` character and match the end of the string. The `^` and `$` characters ensure that the regular expression matches the entire route parameter value. Without the `^` and `$` characters, the regular expression matches any substring within the string, which is often undesirable. The following table provides examples and explains why they match or fail to match: +Regular expressions used in routing often start with the `^` character and match the starting position of the string. The expressions often end with the `$` character and match the end of the string. The `^` and `$` characters ensure that the regular expression matches the entire route parameter value. Without the `^` and `$` characters, the regular expression matches any substring within the string, which is often undesirable. The following table provides examples and explains why they match or fail to match. | Expression | String | Match | Comment | | ------------ | --------- | :---: | -------------------- | @@ -1439,7 +1439,7 @@ The constraint name and arguments are passed to the [!WARNING] > Don't use constraints for input validation. If constraints are used for input validation, invalid input results in a `404` Not Found response. Invalid input should produce a `400` Bad Request with an appropriate error message. Route constraints are used to disambiguate similar routes, not to validate the inputs for a particular route. -The following table demonstrates example route constraints and their expected behavior: +The following table demonstrates example route constraints and their expected behavior. | constraint | Example | Example Matches | Notes | |---------------------|---------------------------------------------|----------------------------------------|-------------------------------------------------------------------------------------------| @@ -1551,14 +1551,14 @@ Regular expressions use delimiters and tokens similar to those used by routing a * Replace `\` characters provided in the string as `\\` characters in the C# source file in order to escape the `\` string escape character. * [Verbatim string literals](/dotnet/csharp/language-reference/keywords/string). -To escape routing parameter delimiter characters `{`, `}`, `[`, `]`, double the characters in the expression, for example, `{{`, `}}`, `[[`, `]]`. The following table shows a regular expression and its escaped version: +To escape routing parameter delimiter characters `{`, `}`, `[`, `]`, double the characters in the expression, for example, `{{`, `}}`, `[[`, `]]`. The following table shows a regular expression and its escaped version. | Regular expression | Escaped regular expression | | --------------------- | ------------------------------ | | `^\d{3}-\d{2}-\d{4}$` | `^\\d{{3}}-\\d{{2}}-\\d{{4}}$` | | `^[a-z]{2}$` | `^[[a-z]]{{2}}$` | -Regular expressions used in routing often start with the `^` character and match the starting position of the string. The expressions often end with the `$` character and match the end of the string. The `^` and `$` characters ensure that the regular expression matches the entire route parameter value. Without the `^` and `$` characters, the regular expression matches any substring within the string, which is often undesirable. The following table provides examples and explains why they match or fail to match: +Regular expressions used in routing often start with the `^` character and match the starting position of the string. The expressions often end with the `$` character and match the end of the string. The `^` and `$` characters ensure that the regular expression matches the entire route parameter value. Without the `^` and `$` characters, the regular expression matches any substring within the string, which is often undesirable. The following table provides examples and explains why they match or fail to match. | Expression | String | Match | Comment | | ------------ | --------- | :---: | -------------------- | @@ -2438,7 +2438,7 @@ The constraint name and arguments are passed to the [!WARNING] > Don't use constraints for input validation. If constraints are used for input validation, invalid input results in a `404` Not Found response. Invalid input should produce a `400` Bad Request with an appropriate error message. Route constraints are used to disambiguate similar routes, not to validate the inputs for a particular route. -The following table demonstrates example route constraints and their expected behavior: +The following table demonstrates example route constraints and their expected behavior. | constraint | Example | Example Matches | Notes | |---------------------|---------------------------------------------|----------------------------------------|-------------------------------------------------------------------------------------------| @@ -2548,14 +2548,14 @@ Regular expressions use delimiters and tokens similar to those used by routing a * Replace `\` characters provided in the string as `\\` characters in the C# source file in order to escape the `\` string escape character. * [Verbatim string literals](/dotnet/csharp/language-reference/keywords/string). -To escape routing parameter delimiter characters `{`, `}`, `[`, `]`, double the characters in the expression, for example, `{{`, `}}`, `[[`, `]]`. The following table shows a regular expression and its escaped version: +To escape routing parameter delimiter characters `{`, `}`, `[`, `]`, double the characters in the expression, for example, `{{`, `}}`, `[[`, `]]`. The following table shows a regular expression and its escaped version. | Regular expression | Escaped regular expression | | --------------------- | ------------------------------ | | `^\d{3}-\d{2}-\d{4}$` | `^\\d{{3}}-\\d{{2}}-\\d{{4}}$` | | `^[a-z]{2}$` | `^[[a-z]]{{2}}$` | -Regular expressions used in routing often start with the `^` character and match the starting position of the string. The expressions often end with the `$` character and match the end of the string. The `^` and `$` characters ensure that the regular expression matches the entire route parameter value. Without the `^` and `$` characters, the regular expression matches any substring within the string, which is often undesirable. The following table provides examples and explains why they match or fail to match: +Regular expressions used in routing often start with the `^` character and match the starting position of the string. The expressions often end with the `$` character and match the end of the string. The `^` and `$` characters ensure that the regular expression matches the entire route parameter value. Without the `^` and `$` characters, the regular expression matches any substring within the string, which is often undesirable. The following table provides examples and explains why they match or fail to match. | Expression | String | Match | Comment | | ------------ | --------- | :---: | -------------------- | diff --git a/aspnetcore/fundamentals/servers/httpsys.md b/aspnetcore/fundamentals/servers/httpsys.md index b1586b0a2c79..f4d5fde265d3 100644 --- a/aspnetcore/fundamentals/servers/httpsys.md +++ b/aspnetcore/fundamentals/servers/httpsys.md @@ -5,7 +5,7 @@ author: tdykstra description: Learn about HTTP.sys, a web server for ASP.NET Core on Windows. Built on the HTTP.sys kernel-mode driver, HTTP.sys is an alternative to Kestrel that can be used for direct connection to the Internet without IIS. monikerRange: '>= aspnetcore-2.1' ms.author: tdykstra -ms.date: 04/30/2026 +ms.date: 07/29/2026 uid: fundamentals/servers/httpsys --- # HTTP.sys web server implementation in ASP.NET Core @@ -223,7 +223,7 @@ In Visual Studio, the default launch profile is for IIS Express. To run the proj > [!WARNING] > Top-level wildcard bindings (`http://*:80/` and `http://+:80`) should **not** be used. Top-level wildcard bindings create app security vulnerabilities. This applies to both strong and weak wildcards. Use explicit host names or IP addresses rather than wildcards. Subdomain wildcard binding (for example, `*.mysub.com`) isn't a security risk if you control the entire parent domain (as opposed to `*.com`, which is vulnerable). For more information, see [RFC 9110: Section 7.2: Host and :authority](https://www.rfc-editor.org/rfc/rfc9110#field.host). - [!INCLUDE [http-ports](~/includes/http-ports.md)] + [!INCLUDE[](~/includes/http-ports.md)] These configuration keys are equivalent to top-level wildcard bindings. They're convenient for development and container scenarios, but avoid wildcards when running on a machine that may also host other services. diff --git a/aspnetcore/fundamentals/servers/httpsys/includes/httpsys8-9.md b/aspnetcore/fundamentals/servers/httpsys/includes/httpsys8-9.md index 10b299f5c43e..ecee44328915 100644 --- a/aspnetcore/fundamentals/servers/httpsys/includes/httpsys8-9.md +++ b/aspnetcore/fundamentals/servers/httpsys/includes/httpsys8-9.md @@ -1,4 +1,3 @@ - :::moniker range=">= aspnetcore-8.0 <= aspnetcore-9.0" [HTTP.sys](/iis/get-started/introduction-to-iis/introduction-to-iis-architecture#hypertext-transfer-protocol-stack-httpsys) is a [web server for ASP.NET Core](xref:fundamentals/servers/index) that only runs on Windows. HTTP.sys is an alternative to [Kestrel](xref:fundamentals/servers/kestrel) server and offers some features that Kestrel doesn't provide. @@ -192,7 +191,7 @@ In Visual Studio, the default launch profile is for IIS Express. To run the proj > [!WARNING] > Top-level wildcard bindings (`http://*:80/` and `http://+:80`) should **not** be used. Top-level wildcard bindings create app security vulnerabilities. This applies to both strong and weak wildcards. Use explicit host names or IP addresses rather than wildcards. Subdomain wildcard binding (for example, `*.mysub.com`) isn't a security risk if you control the entire parent domain (as opposed to `*.com`, which is vulnerable). For more information, see [RFC 9110: Section 7.2: Host and :authority](https://www.rfc-editor.org/rfc/rfc9110#field.host). - [!INCLUDE [http-ports](~/includes/http-ports.md)] + [!INCLUDE[](~/includes/http-ports.md)] These configuration keys are equivalent to top-level wildcard bindings. They're convenient for development and container scenarios, but avoid wildcards when running on a machine that may also host other services. diff --git a/aspnetcore/fundamentals/servers/kestrel/endpoints.md b/aspnetcore/fundamentals/servers/kestrel/endpoints.md index df5bcf383f21..fffdcffab548 100644 --- a/aspnetcore/fundamentals/servers/kestrel/endpoints.md +++ b/aspnetcore/fundamentals/servers/kestrel/endpoints.md @@ -4,7 +4,7 @@ author: tdykstra description: Learn about configuring endpoints with Kestrel, the cross-platform web server for ASP.NET Core. monikerRange: '>= aspnetcore-5.0' ms.author: tdykstra -ms.date: 06/01/2026 +ms.date: 07/29/2026 uid: fundamentals/servers/kestrel/endpoints --- # Configure endpoints for the ASP.NET Core Kestrel web server @@ -96,9 +96,9 @@ You can define endpoints by using HTTPS URL prefixes only if a default certifica ### Specify ports only -[!INCLUDE [http-ports](~/includes/http-ports.md)] +[!INCLUDE[](~/includes/http-ports.md)] -### Create endpoints in appsettings.json +### Create endpoints in `appsettings.json` Kestrel can load endpoints from an instance. By default, Kestrel configuration is loaded from the `Kestrel` section and endpoints are configured in `Kestrel:Endpoints`: diff --git a/aspnetcore/fundamentals/servers/kestrel/endpoints/includes/endpoints5-7.md b/aspnetcore/fundamentals/servers/kestrel/endpoints/includes/endpoints5-7.md index 479cc82d662d..2b6492544ebf 100644 --- a/aspnetcore/fundamentals/servers/kestrel/endpoints/includes/endpoints5-7.md +++ b/aspnetcore/fundamentals/servers/kestrel/endpoints/includes/endpoints5-7.md @@ -13,8 +13,6 @@ The value provided using these approaches can be one or more HTTP and HTTPS endp For more information on these approaches, see [Server URLs](xref:fundamentals/host/web-host#server-urls) and [Override configuration](xref:fundamentals/host/web-host#override-configuration). - - A development certificate is created: * When the [.NET SDK](/dotnet/core/sdk) is installed. diff --git a/aspnetcore/fundamentals/servers/kestrel/security-considerations.md b/aspnetcore/fundamentals/servers/kestrel/security-considerations.md index 9c820d9c0435..358fd3b4557e 100644 --- a/aspnetcore/fundamentals/servers/kestrel/security-considerations.md +++ b/aspnetcore/fundamentals/servers/kestrel/security-considerations.md @@ -5,7 +5,7 @@ author: BrennanConroy description: Learn about the security considerations, configurable limits, and behavioral decisions in Kestrel, the cross-platform web server for ASP.NET Core. monikerRange: '>= aspnetcore-8.0' ms.author: brecon -ms.date: 07/13/2026 +ms.date: 07/29/2026 uid: fundamentals/servers/kestrel/security-considerations --- # Security considerations for the ASP.NET Core Kestrel web server @@ -714,12 +714,14 @@ app.UseHttpsRedirection(); ``` | Option | Default | Description | -|---|---|---| -| `HttpsPort` | Auto-detected | The HTTPS port to redirect to. Auto-detected from `HTTPS_PORT` environment variable or `IServerAddressesFeature`. | -| `RedirectStatusCode` | 307 (Temporary Redirect) | Use `308` (Permanent Redirect) for production APIs where clients should cache the redirect. | +| --- | --- | --- | +| | Auto-detected | The HTTPS port to redirect to. Auto-detected from the `HTTPS_PORT` configuration key, the `ASPNETCORE_HTTPS_PORT` environment variable, or the . | +| | 307 (Temporary Redirect) | Use 308 (Permanent Redirect) for production APIs, where clients should cache the redirect. | > [!NOTE] > **Edge servers:** Enable HTTPS Redirection. **Behind a proxy**: Often unnecessary if the proxy handles TLS termination and all internal traffic is over a private network. +> +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). ### HTTP strict transport security (HSTS) diff --git a/aspnetcore/grpc/configuration.md b/aspnetcore/grpc/configuration.md index dbd25e1518dd..552c1f1faef0 100644 --- a/aspnetcore/grpc/configuration.md +++ b/aspnetcore/grpc/configuration.md @@ -15,7 +15,7 @@ uid: grpc/configuration gRPC services are configured with `AddGrpc` in `Startup.cs`. Configuration options are in the [`Grpc.AspNetCore.Server`](https://www.nuget.org/packages/Grpc.AspNetCore.Server) package. -The following table describes options for configuring gRPC services: +The following table describes options for configuring gRPC services. | Option | Default Value | Description | | ------ | ------------- | ----------- | @@ -56,7 +56,7 @@ For more information about the different servers and their configuration options gRPC client configuration is set on `GrpcChannelOptions`. Configuration options are in the [`Grpc.Net.Client`](https://www.nuget.org/packages/Grpc.Net.Client) package. -The following table describes options for configuring gRPC channels: +The following table describes options for configuring gRPC channels. | Option | Default Value | Description | | ------ | ------------- | ----------- | diff --git a/aspnetcore/grpc/protobuf.md b/aspnetcore/grpc/protobuf.md index 9800929c4185..765c99986f7f 100644 --- a/aspnetcore/grpc/protobuf.md +++ b/aspnetcore/grpc/protobuf.md @@ -52,7 +52,7 @@ For more information about Protobuf messages see the [Protobuf language guide](h ## Scalar Value Types -Protobuf supports a range of native scalar value types. The following table lists them all with their equivalent C# type: +Protobuf supports a range of native scalar value types. The following table lists them all with their equivalent C# type. | Protobuf type | C# type | | ------------- | ------------ | @@ -138,7 +138,7 @@ message Person { `wrappers.proto` types aren't exposed in generated properties. Protobuf automatically maps them to appropriate .NET nullable types in C# messages. For example, a `google.protobuf.Int32Value` field generates an `int?` property. Reference type properties like `string` and `ByteString` are unchanged except `null` can be assigned to them without error. -The following table shows the complete list of wrapper types with their equivalent C# type: +The following table shows the complete list of wrapper types with their equivalent C# type. | C# type | Well-Known Type wrapper | | ------------ | ----------------------------- | diff --git a/aspnetcore/grpc/retries.md b/aspnetcore/grpc/retries.md index 0f969c9dd881..9dae06465a00 100644 --- a/aspnetcore/grpc/retries.md +++ b/aspnetcore/grpc/retries.md @@ -136,7 +136,7 @@ The `grpc-previous-rpc-attempts` metadata is not present on the initial gRPC cal ### gRPC retry options -The following table describes options for configuring gRPC retry policies: +The following table describes options for configuring gRPC retry policies. | Option | Description | | ------ | ----------- | @@ -178,7 +178,7 @@ var channel = GrpcChannel.ForAddress("https://localhost:5001", new GrpcChannelOp ### gRPC hedging options -The following table describes options for configuring gRPC hedging policies: +The following table describes options for configuring gRPC hedging policies. | Option | Description | | ------ | ----------- | diff --git a/aspnetcore/grpc/supported-platforms.md b/aspnetcore/grpc/supported-platforms.md index ffcd3aa22cd7..72a7436961d6 100644 --- a/aspnetcore/grpc/supported-platforms.md +++ b/aspnetcore/grpc/supported-platforms.md @@ -91,7 +91,7 @@ The [Grpc.Net.Client](https://www.nuget.org/packages/Grpc.Net.Client/) package s Limited support is available for gRPC over HTTP/2 on .NET Framework. Other .NET versions such as UWP and Unity don't have required HTTP/2 support, and must use gRPC-Web instead. -The following table lists .NET implementations and their gRPC client support: +The following table lists .NET implementations and their gRPC client support. | .NET implementation | gRPC over HTTP/2 | gRPC-Web | |----------------------------------------------|--------------------|------------| diff --git a/aspnetcore/includes/http-ports.md b/aspnetcore/includes/http-ports.md index a27221fd9dba..4aca8326b47a 100644 --- a/aspnetcore/includes/http-ports.md +++ b/aspnetcore/includes/http-ports.md @@ -1,4 +1,4 @@ -Most configurations for apps and containers define only a port for listening, like port 80, without specifying other constraints like the host or path. HTTP_PORTS and HTTPS_PORTS are config keys that specify the listening ports for the Kestrel and HTTP.sys servers. You can specify the keys as environment variables defined with the `DOTNET_` or `ASPNETCORE_` prefixes, or set them directly through any other config input, such as the _appsettings.json_ file. Each configuration is a semicolon-delimited list of port values, as shown in the following example: +Most configurations for apps and containers define only a port for listening, like port 80, without specifying other constraints like the host or path. `HTTP_PORTS` and `HTTPS_PORTS` are config keys that specify the listening ports for the Kestrel and HTTP.sys servers. You can specify the keys as environment variables defined with the `DOTNET_` or `ASPNETCORE_` prefixes, or set them directly through any other config input, such as the `appsettings.json` file. Each configuration is a semicolon-delimited list of port values, as shown in the following example: ```json ASPNETCORE_HTTP_PORTS=80;8080 @@ -11,4 +11,7 @@ The configuration in the example is shorthand for the following specification, w ASPNETCORE_URLS=http://*:80/;http://*:8080/;https://*:443/;https://*:8081/ ``` -The HTTP_PORTS and HTTPS_PORTS configuration keys are lower priority. If other URLs or values are set directly in code, they can override the configuration keys. You still need to configure certificates separately by using server-specific mechanics for HTTPS. +The `HTTP_PORTS` and `HTTPS_PORTS` configuration keys are lower priority. If other URLs or values are set directly in code, they can override the configuration keys. Configure certificates separately using server-specific mechanics for HTTPS. + +> [!NOTE] +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). diff --git a/aspnetcore/includes/mvc-intro/model4.md b/aspnetcore/includes/mvc-intro/model4.md index 2881536da58e..fb56f564a80e 100644 --- a/aspnetcore/includes/mvc-intro/model4.md +++ b/aspnetcore/includes/mvc-intro/model4.md @@ -1,4 +1,4 @@ -The following table details the ASP.NET Core code generator parameters: +The following table details the ASP.NET Core code generator parameters. | Parameter | Description| | ----------------- | ------------ | diff --git a/aspnetcore/includes/mvc-intro/model7.md b/aspnetcore/includes/mvc-intro/model7.md index 15181da79e32..bebc4060cb3f 100644 --- a/aspnetcore/includes/mvc-intro/model7.md +++ b/aspnetcore/includes/mvc-intro/model7.md @@ -1,4 +1,4 @@ -The following table details the ASP.NET Core code generator parameters: +The following table details the ASP.NET Core code generator parameters. | Parameter | Description| | ----------------- | ------------ | diff --git a/aspnetcore/migration/20-to-21.md b/aspnetcore/migration/20-to-21.md index cf4c2c30e463..1a6948928d80 100644 --- a/aspnetcore/migration/20-to-21.md +++ b/aspnetcore/migration/20-to-21.md @@ -75,7 +75,7 @@ Known issues for projects targeting a shared framework: ## Update to the 2.1 Docker images -In ASP.NET Core 2.1, the Docker images migrated to the [dotnet/dotnet-docker GitHub repository](https://github.com/dotnet/dotnet-docker). The following table shows the Docker image and tag changes: +In ASP.NET Core 2.1, the Docker images migrated to the [dotnet/dotnet-docker GitHub repository](https://github.com/dotnet/dotnet-docker). The following table shows the Docker image and tag changes. |2.0 |2.1 | |---------|---------| diff --git a/aspnetcore/migration/21-to-22.md b/aspnetcore/migration/21-to-22.md index 1f329115539e..92ee11e2ffff 100644 --- a/aspnetcore/migration/21-to-22.md +++ b/aspnetcore/migration/21-to-22.md @@ -177,7 +177,7 @@ To correct this problem on the server, take one of the following actions: ## Update Docker images -The following table shows the Docker image tag changes: +The following table shows the Docker image tag changes. | 2.1 | 2.2 | | ----------------------------------------- | ----------------------------------------- | diff --git a/aspnetcore/migration/50-to-60-samples.md b/aspnetcore/migration/50-to-60-samples.md index a2fd9cb72a9b..f2a35082a03e 100644 --- a/aspnetcore/migration/50-to-60-samples.md +++ b/aspnetcore/migration/50-to-60-samples.md @@ -90,7 +90,7 @@ For more information, see #### Change the content root, app name, and environment by environment variables or command line -The following table shows the environment variable and command-line argument used to change the content root, app name, and environment: +The following table shows the environment variable and command-line argument used to change the content root, app name, and environment. | feature | Environment variable | Command-line argument | | ------------- | ------------- | -- | diff --git a/aspnetcore/mvc/controllers/routing.md b/aspnetcore/mvc/controllers/routing.md index ec94320d5920..c7269ad4a3b7 100644 --- a/aspnetcore/mvc/controllers/routing.md +++ b/aspnetcore/mvc/controllers/routing.md @@ -426,7 +426,7 @@ Route templates that you apply to an action and that begin with `/` or `~/` don' [!code-csharp[](routing/samples/6.x/main/Controllers/HomeController.cs?name=snippet)] -The following table explains the `[Route]` attributes in the preceding code: +The following table explains the `[Route]` attributes in the preceding code. | Attribute | Combines with `[Route("Home")]` | Defines route template | | ----------------- | ------------ | --------- | @@ -1268,7 +1268,7 @@ Route templates that you apply to an action and that begin with `/` or `~/` don' [!code-csharp[](routing/samples/3.x/main/Controllers/HomeController.cs?name=snippet)] -The following table explains the `[Route]` attributes in the preceding code: +The following table explains the `[Route]` attributes in the preceding code. | Attribute | Combines with `[Route("Home")]` | Defines route template | | ----------------- | ------------ | --------- | diff --git a/aspnetcore/mvc/views/razor.md b/aspnetcore/mvc/views/razor.md index 0f1926e08387..6a46721ab169 100644 --- a/aspnetcore/mvc/views/razor.md +++ b/aspnetcore/mvc/views/razor.md @@ -696,7 +696,7 @@ The `@namespace` directive: @namespace Your.Namespace.Here ``` -For the Razor Pages example shown in the following table: +For the Razor Pages example shown in the following table. * Each page imports `Pages/_ViewImports.cshtml`. * `Pages/_ViewImports.cshtml` contains `@namespace Hello.World`. diff --git a/aspnetcore/mvc/views/working-with-forms.md b/aspnetcore/mvc/views/working-with-forms.md index 1013f1d21ef3..3c8b9a8a4975 100644 --- a/aspnetcore/mvc/views/working-with-forms.md +++ b/aspnetcore/mvc/views/working-with-forms.md @@ -198,7 +198,7 @@ The `Input` Tag Helper sets the HTML `type` attribute based on the .NET type. Th |Int|type="number"| |Single, Double|type="number"| -The following table shows some common [data annotations](xref:Microsoft.AspNetCore.Mvc.DataAnnotations.IAttributeAdapter) attributes that the input tag helper will map to specific input types (not every validation attribute is listed): +The following table shows some common [data annotations](xref:Microsoft.AspNetCore.Mvc.DataAnnotations.IAttributeAdapter) attributes that the input tag helper will map to specific input types (not every validation attribute is listed). |Attribute|Input Type| |---|---| diff --git a/aspnetcore/performance/caching/response.md b/aspnetcore/performance/caching/response.md index a7471aa72aed..b155cd1772c7 100644 --- a/aspnetcore/performance/caching/response.md +++ b/aspnetcore/performance/caching/response.md @@ -65,7 +65,7 @@ The class specifies the p The property varies the stored response by the values of the given list of query keys. When a single value of the wildcard asterisk (`*`) is provided, the middleware varies responses by all request query string parameters. -[Response caching middleware](xref:performance/caching/middleware) must be enabled to set the property. Otherwise, a runtime exception is thrown. There isn't a corresponding HTTP header for the property. The property is an HTTP feature handled by response caching middleware. For the middleware to serve a cached response, the query string and query string value must match a previous request. For example, consider the sequence of requests and results shown in the following table: +[Response caching middleware](xref:performance/caching/middleware) must be enabled to set the property. Otherwise, a runtime exception is thrown. There isn't a corresponding HTTP header for the property. The property is an HTTP feature handled by response caching middleware. For the middleware to serve a cached response, the query string and query string value must match a previous request. For example, consider the sequence of requests and results shown in the following table. | Request | Returned from | | -------------------------------- | ------------------------- | diff --git a/aspnetcore/razor-pages/index.md b/aspnetcore/razor-pages/index.md index 206d8f784304..018d0003f0aa 100644 --- a/aspnetcore/razor-pages/index.md +++ b/aspnetcore/razor-pages/index.md @@ -77,7 +77,7 @@ The `Pages/Index2.cshtml.cs` page model: By convention, the `PageModel` class file has the same name as the Razor Page file with `.cs` appended. For example, the previous Razor Page is `Pages/Index2.cshtml`. The file containing the `PageModel` class is named `Pages/Index2.cshtml.cs`. -The associations of URL paths to pages are determined by the page's location in the file system. The following table shows a Razor Page path and the matching URL: +The associations of URL paths to pages are determined by the page's location in the file system. The following table shows a Razor Page path and the matching URL. | File name and path | matching URL | | ----------------- | ------------ | diff --git a/aspnetcore/razor-pages/index/includes/index35.md b/aspnetcore/razor-pages/index/includes/index35.md index 1bd85b6af4d9..fa00c3d81de2 100644 --- a/aspnetcore/razor-pages/index/includes/index35.md +++ b/aspnetcore/razor-pages/index/includes/index35.md @@ -76,7 +76,7 @@ The `Pages/Index2.cshtml.cs` page model: By convention, the `PageModel` class file has the same name as the Razor Page file with `.cs` appended. For example, the previous Razor Page is `Pages/Index2.cshtml`. The file containing the `PageModel` class is named `Pages/Index2.cshtml.cs`. -The associations of URL paths to pages are determined by the page's location in the file system. The following table shows a Razor Page path and the matching URL: +The associations of URL paths to pages are determined by the page's location in the file system. The following table shows a Razor Page path and the matching URL. | File name and path | matching URL | | ----------------- | ------------ | diff --git a/aspnetcore/release-notes/aspnetcore-8.0.md b/aspnetcore/release-notes/aspnetcore-8.0.md index 428323820b20..16c47cd56e71 100644 --- a/aspnetcore/release-notes/aspnetcore-8.0.md +++ b/aspnetcore/release-notes/aspnetcore-8.0.md @@ -3,7 +3,7 @@ title: What's new in ASP.NET Core in .NET 8 author: tdykstra description: Learn about the new features in ASP.NET Core in .NET 8. ms.author: tdykstra -ms.date: 10/30/2025 +ms.date: 07/29/2026 uid: aspnetcore-8 --- # What's new in ASP.NET Core in .NET 8 @@ -729,20 +729,7 @@ If TLS is disabled and HTTP/1.x is available, HTTP/2 and HTTP/3 will be disabled ### `HTTP_PORTS` and `HTTPS_PORTS` config keys -Applications and containers are often only given a port to listen on, like 80, without additional constraints like host or path. `HTTP_PORTS` and `HTTPS_PORTS` are new config keys that allow specifying the listening ports for the Kestrel and HTTP.sys servers. These can be defined with the `DOTNET_` or `ASPNETCORE_` environment variable prefixes, or specified directly through any other config input like appsettings.json. Each is a semicolon delimited list of port values. For example: - -```cli -ASPNETCORE_HTTP_PORTS=80;8080 -ASPNETCORE_HTTPS_PORTS=443;8081 -``` - -This is shorthand for the following, which specifies the scheme (HTTP or HTTPS) and any host or IP: - -```cli -ASPNETCORE_URLS=http://*:80/;http://*:8080/;https://*:443/;https://*:8081/ -``` - -For more information, see and . +[!INCLUDE[](~/includes/http-ports.md)] ### SNI host name in ITlsHandshakeFeature diff --git a/aspnetcore/release-notes/aspnetcore-9/includes/web_asset_delivery.md b/aspnetcore/release-notes/aspnetcore-9/includes/web_asset_delivery.md index 4e80d311ab9b..c4e30a00415f 100644 --- a/aspnetcore/release-notes/aspnetcore-9/includes/web_asset_delivery.md +++ b/aspnetcore/release-notes/aspnetcore-9/includes/web_asset_delivery.md @@ -53,7 +53,7 @@ app.Run(); * All assets are compressed with the goal of reducing the size of the assets to the minimum. * Content based `ETags`: The `Etags` for each resource are the [Base64](https://developer.mozilla.org/docs/Glossary/Base64) encoded string of the [SHA-256](/dotnet/api/system.security.cryptography.sha256?view=net-8.0&preserve-view=true) hash of the content. This ensures that the browser only redownloads a file if its contents have changed. -The following table shows the original and compressed sizes of the CSS and JS files in the default Razor Pages template: +The following table shows the original and compressed sizes of the CSS and JS files in the default Razor Pages template. File | Original | Compressed | % Reduction -- | -- | -- @@ -62,7 +62,7 @@ jquery.js | 89.6 | 28 | 68.75% bootstrap.min.js | 78.5 | 20 | 74.52% **Total** | 331.1 | 65.5 | 80.20% -The following table shows the original and compressed sizes using the [Fluent UI Blazor components library](https://www.fluentui-blazor.net/): +The following table shows the original and compressed sizes using the [Fluent UI Blazor components library](https://www.fluentui-blazor.net/). File | Original | Compressed | % Reduction -- | -- | -- | -- @@ -72,7 +72,7 @@ fluent.css | 94 | 11 | 88.30% For a total of 478 KB uncompressed to 84 KB compressed. -The following table shows the original and compressed sizes using the [MudBlazor](https://mudblazor.com) Blazor components library: +The following table shows the original and compressed sizes using the [MudBlazor](https://mudblazor.com) Blazor components library. File | Original | Compressed | Reduction -- | -- | -- | -- @@ -99,7 +99,7 @@ If we take MudBlazor as an example, IIS will compress the CSS bundle at around 9 * Is more performant because the assets are compressed at build time. * Allows the developer to spend extra time during the build process to ensure that the assets are the minimum size. -Consider the following table comparing MudBlazor compression with IIS dynamic compression and `MapStaticAssets`: +Consider the following table comparing MudBlazor compression with IIS dynamic compression and `MapStaticAssets`. IIS gzip | `MapStaticAssets` | `MapStaticAssets` reduction diff --git a/aspnetcore/security/authentication/individual.md b/aspnetcore/security/authentication/individual.md index ea9d4ce5e014..d7b8eff39dd8 100644 --- a/aspnetcore/security/authentication/individual.md +++ b/aspnetcore/security/authentication/individual.md @@ -53,7 +53,7 @@ If Windows Authentication is selected, the app is configured to use the [Windows ## dotnet new webapp authentication options -The following table shows the authentication options available for new web apps: +The following table shows the authentication options available for new web apps. | Option | Type of authentication | Link for more information | | ----------------- | ------------ | ---------- | @@ -68,7 +68,7 @@ The following table shows the authentication options available for new web apps: ## Visual Studio new webapp authentication options -The following table shows the authentication options available when creating a new web app with Visual Studio: +The following table shows the authentication options available when creating a new web app with Visual Studio. | Option | Type of authentication | Link for more information | | ----------------- | ------------ | ---------- | diff --git a/aspnetcore/security/authorization/custom-authorization-policies-with-iauthorizationrequirementdata.md b/aspnetcore/security/authorization/custom-authorization-policies-with-iauthorizationrequirementdata.md index 31bd43a8037c..54439c67b225 100644 --- a/aspnetcore/security/authorization/custom-authorization-policies-with-iauthorizationrequirementdata.md +++ b/aspnetcore/security/authorization/custom-authorization-policies-with-iauthorizationrequirementdata.md @@ -5,7 +5,7 @@ author: tdykstra description: Learn how to specify requirements associated with the authorization policy in attribute definitions with the IAuthorizationRequirementData interface. monikerRange: '>= aspnetcore-8.0' ms.author: tdykstra -ms.date: 03/11/2026 +ms.date: 07/29/2026 uid: security/authorization/iard --- # Custom authorization policies with `IAuthorizationRequirementData` @@ -16,7 +16,7 @@ This article uses a [Minimal API](xref:fundamentals/minimal-apis) endpoint withi ## Sample app -The Blazor Web App sample for this article is the [`AuthRequirementsDataBWA` sample app (`dotnet/AspNetCore.Docs.Samples` GitHub repository)](https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/security/authorization/AuthRequirementsDataBWA) ([how to download](xref:index#how-to-download-a-sample)). The sample app implements a minimum age handler for users, requiring a user to present a birth date claim indicating that they're at least 21 years old. +The Blazor Web App sample for this article is the [`AuthRequirementsDataBWA` sample app (`dotnet/AspNetCore.Docs.Samples` GitHub repository)](https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/security/authorization/AuthRequirementsDataBWA) ([how to download](xref:index#how-to-download-a-sample)). The sample app implements a minimum age handler for users accessing a Minimal API endpoint at `/api/greetings/hello`, requiring a user to present a birth date claim indicating that they're at least 21 years old. ## Minimum age authorize attribute diff --git a/aspnetcore/security/docker-https.md b/aspnetcore/security/docker-https.md index 3b51386ecd7a..ed302568cec4 100644 --- a/aspnetcore/security/docker-https.md +++ b/aspnetcore/security/docker-https.md @@ -5,7 +5,7 @@ author: wadepickett description: Learn how to host ASP.NET Core Images with Docker over HTTPS ms.author: wpickett ms.custom: sfi-ropc-nochange -ms.date: 03/03/2026 +ms.date: 07/29/2026 uid: security/docker-https --- # Hosting ASP.NET Core images with Docker over HTTPS @@ -69,7 +69,10 @@ In the preceding code, replace `` with the password. The When using [PowerShell](/powershell/scripting/overview), replace `%USERPROFILE%` with `$env:USERPROFILE`. -Note: The certificate in this case must be a `.pfx` file. Utilizing a `.crt` or `.key` file with or without the password isn't supported with the sample container. For example, when specifying a `.crt` file, the container may return error messages such as 'The server mode SSL must use a certificate with the associated private key.'. When using [WSL](/windows/wsl/about), validate the mount path to ensure that the certificate loads correctly. +The certificate in this case must be a `.pfx` file. Utilizing a `.crt` or `.key` file with or without the password isn't supported with the sample container. For example, when specifying a `.crt` file, the container may return error messages such as 'The server mode SSL must use a certificate with the associated private key.'. When using [WSL](/windows/wsl/about), validate the mount path to ensure that the certificate loads correctly. + +> [!NOTE] +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). ### macOS or Linux @@ -93,6 +96,9 @@ docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http:// In the preceding code, replace `` with the password. The password must match the password used for the certificate. +> [!NOTE] +> Don't confuse the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration, with the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for [HTTPS redirection middleware](xref:security/enforcing-ssl#https-redirection-middleware-usehttpsredirection). + ### Windows using Windows containers Generate certificate and configure local machine: diff --git a/aspnetcore/security/enforcing-ssl.md b/aspnetcore/security/enforcing-ssl.md index f719af363ec3..33fc86963698 100644 --- a/aspnetcore/security/enforcing-ssl.md +++ b/aspnetcore/security/enforcing-ssl.md @@ -5,7 +5,7 @@ description: Learn how to require HTTPS/TLS in an ASP.NET Core web app, and find ms.author: tdykstra monikerRange: '>= aspnetcore-3.0' ms.custom: linux-related-content -ms.date: 05/13/2026 +ms.date: 07/29/2026 uid: security/enforcing-ssl # customer intent: As an ASP.NET Core web app developer, I want to force incoming requests to use HTTPS/TLS, so I can avoid insecure interaction with my apps. @@ -63,7 +63,7 @@ For production ASP.NET Core web apps, the following approach is recommended: > [!NOTE] > Apps deployed in a reverse proxy configuration allow the proxy to handle connection security (HTTPS). If the proxy also handles HTTPS redirection, there's no need to use HTTPS redirection middleware. If the proxy server also handles writing HSTS headers (for example, [native HSTS support in Internet Information Services (IIS) 10.0 version 1709 or later](/iis/get-started/whats-new-in-iis-10-version-1709/iis-10-version-1709-hsts#iis-100-version-1709-native-hsts-support)), then the app doesn't require HSTS middleware. For more information, see [Opt-out of HTTPS/HSTS on project creation](#opt-out-of-httpshsts-on-project-creation). -### UseHttpsRedirection +### HTTPS redirection middleware (`UseHttpsRedirection`) The following code calls the method in the _Program.cs_ file: @@ -76,6 +76,9 @@ The preceding highlighted code: The recommended approach is to use temporary redirects rather than permanent redirects. Link caching can cause unstable behavior in development environments. If you prefer to send a permanent redirect status code when the app is in a non-`Development` environment, see the [Configure permanent redirects in production](#configure-permanent-redirects-in-production) section. Use [HSTS](#hsts) to signal to clients that only secure resource requests should be sent to the app (only in production). +> [!NOTE] +> Don't confuse the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for HTTPS redirection middleware, with the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration. + ### Port configuration A port must be available for the middleware to redirect an insecure request to HTTPS. If no port is available: diff --git a/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl6.md b/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl6.md index 2fec25104b63..39868b983c3a 100644 --- a/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl6.md +++ b/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl6.md @@ -35,7 +35,7 @@ We recommend that production ASP.NET Core web apps use: > [!NOTE] > Apps deployed in a reverse proxy configuration allow the proxy to handle connection security (HTTPS). If the proxy also handles HTTPS redirection, there's no need to use HTTPS redirection middleware. If the proxy server also handles writing HSTS headers (for example, [native HSTS support in IIS 10.0 (1709) or later](/iis/get-started/whats-new-in-iis-10-version-1709/iis-10-version-1709-hsts#iis-100-version-1709-native-hsts-support)), HSTS middleware isn't required by the app. For more information, see [Opt-out of HTTPS/HSTS on project creation](#opt-out-of-httpshsts-on-project-creation). -### UseHttpsRedirection +### HTTPS redirection middleware (`UseHttpsRedirection`) The following code calls in the `Program.cs` file: diff --git a/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl7.md b/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl7.md index 701847e7525c..61816c805a6e 100644 --- a/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl7.md +++ b/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl7.md @@ -35,7 +35,7 @@ We recommend that production ASP.NET Core web apps use: > [!NOTE] > Apps deployed in a reverse proxy configuration allow the proxy to handle connection security (HTTPS). If the proxy also handles HTTPS redirection, there's no need to use HTTPS redirection middleware. If the proxy server also handles writing HSTS headers (for example, [native HSTS support in IIS 10.0 (1709) or later](/iis/get-started/whats-new-in-iis-10-version-1709/iis-10-version-1709-hsts#iis-100-version-1709-native-hsts-support)), HSTS middleware isn't required by the app. For more information, see [Opt-out of HTTPS/HSTS on project creation](#opt-out-of-httpshsts-on-project-creation). -### UseHttpsRedirection +### HTTPS redirection middleware (`UseHttpsRedirection`) The following code calls in the `Program.cs` file: diff --git a/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl8.md b/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl8.md index 7c1c6551301a..ef38ef58323d 100644 --- a/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl8.md +++ b/aspnetcore/security/enforcing-ssl/includes/enforcing-ssl8.md @@ -35,7 +35,7 @@ We recommend that production ASP.NET Core web apps use: > [!NOTE] > Apps deployed in a reverse proxy configuration allow the proxy to handle connection security (HTTPS). If the proxy also handles HTTPS redirection, there's no need to use HTTPS redirection middleware. If the proxy server also handles writing HSTS headers (for example, [native HSTS support in IIS 10.0 (1709) or later](/iis/get-started/whats-new-in-iis-10-version-1709/iis-10-version-1709-hsts#iis-100-version-1709-native-hsts-support)), HSTS middleware isn't required by the app. For more information, see [Opt-out of HTTPS/HSTS on project creation](#opt-out-of-httpshsts-on-project-creation). -### UseHttpsRedirection +### HTTPS redirection middleware (`UseHttpsRedirection`) The following code calls in the `Program.cs` file: @@ -48,6 +48,9 @@ The preceding highlighted code: We recommend using temporary redirects rather than permanent redirects. Link caching can cause unstable behavior in development environments. If you prefer to send a permanent redirect status code when the app is in a non-`Development` environment, see the [Configure permanent redirects in production](#configure-permanent-redirects-in-production) section. We recommend using [HSTS](#http-strict-transport-security-hsts-protocol) to signal to clients that only secure resource requests should be sent to the app (only in production). +> [!NOTE] +> Don't confuse the `HTTPS_PORT` configuration key and `ASPNETCORE_HTTPS_PORT` environment variable, which set the port for HTTPS redirection middleware, with the `HTTPS_PORTS` configuration key and `ASPNETCORE_HTTPS_PORTS` environment variable, which set the ports for Kestrel/HTTP.sys endpoint configuration. + ### Port configuration A port must be available for the middleware to redirect an insecure request to HTTPS. If no port is available: diff --git a/aspnetcore/security/includes/docker-https6.md b/aspnetcore/security/includes/docker-https6.md index 94fc75219b84..6827095f6cb5 100644 --- a/aspnetcore/security/includes/docker-https6.md +++ b/aspnetcore/security/includes/docker-https6.md @@ -48,7 +48,7 @@ Run the container image with ASP.NET Core configured for HTTPS in a command shel ```console docker pull mcr.microsoft.com/dotnet/samples:aspnetapp -docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=443 -e ASPNETCORE_Kestrel__Certificates__Default__Password="" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp +docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+:443;http://+" -e ASPNETCORE_Kestrel__Certificates__Default__Password="" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp ``` In the preceding code, replace `` with the password. The password must match the password used for the certificate. @@ -74,7 +74,7 @@ Run the container image with ASP.NET Core configured for HTTPS: ```console docker pull mcr.microsoft.com/dotnet/samples:aspnetapp -docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=443 -e ASPNETCORE_Kestrel__Certificates__Default__Password="" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp +docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+:443;http://+" -e ASPNETCORE_Kestrel__Certificates__Default__Password="" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp ``` In the preceding code, replace `` with the password. The password must match the password used for the certificate. @@ -94,7 +94,7 @@ Run the container image with ASP.NET Core configured for HTTPS: ```console docker pull mcr.microsoft.com/dotnet/samples:aspnetapp -docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=443 -e ASPNETCORE_Kestrel__Certificates__Default__Password="" -e ASPNETCORE_Kestrel__Certificates__Default__Path=c:\https\aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:C:\https\ --user ContainerAdministrator mcr.microsoft.com/dotnet/samples:aspnetapp +docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+:443;http://+" -e ASPNETCORE_Kestrel__Certificates__Default__Password="" -e ASPNETCORE_Kestrel__Certificates__Default__Path=c:\https\aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:C:\https\ --user ContainerAdministrator mcr.microsoft.com/dotnet/samples:aspnetapp ``` ***NOTE:*** `` is a placeholder for the Kestrel certificates default password. diff --git a/aspnetcore/signalr/configuration.md b/aspnetcore/signalr/configuration.md index 7f084929382f..f362ec5bce88 100644 --- a/aspnetcore/signalr/configuration.md +++ b/aspnetcore/signalr/configuration.md @@ -65,7 +65,7 @@ MessagePack serialization can be configured by providing a delegate to the