From ca57f0c8d434c56bfe23d37bab060e8c2be54c23 Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Wed, 12 Nov 2025 14:40:49 -0800 Subject: [PATCH] Remove locale and unneccesary query parameters from links --- .github/ISSUE_TEMPLATE/bug-report.yml | 2 +- .../releases/new-distro-release.md | 2 +- .../ISSUE_TEMPLATE/releases/new-image-release.md | 2 +- CONTRIBUTING.md | 2 +- SECURITY.md | 2 +- documentation/azurelinux.md | 4 ++-- documentation/guiding-principles.md | 2 +- documentation/sample-image-size-report.md | 14 +++++++------- documentation/vulnerability-reporting.md | 4 ++-- eng/common/templates/jobs/cg-build-projects.yml | 2 +- .../Dockerfile.linux.download-files | 2 +- .../Dockerfile.windows.download-files | 2 +- eng/shared/.editorconfig | 2 +- eng/update-dependencies/AzdoAuthProvider.cs | 2 +- samples/aspnetapp/README.md | 2 +- samples/aspnetapp/aspnetapp/Program.cs | 4 ++-- samples/build-in-sdk-container.md | 4 ++-- samples/deploy-container-to-aci.md | 2 +- samples/dotnetapp/README.md | 2 +- samples/dotnetapp/dotnetapp.csproj | 2 +- samples/host-aspnetcore-https.md | 2 +- .../graceful-shutdown/graceful-shutdown.md | 16 ++++++++-------- samples/run-aspnetcore-https-development.md | 2 +- .../TestAppArtifacts/NLSTest.cs | 8 ++++---- tests/run-tests.ps1 | 2 +- 25 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 6b51e892dd..933068b5d1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -10,7 +10,7 @@ body: If you're reporting the presence of a disclosed security vulnerability, such as a CVE reported in one of our container images, please follow our [vulnerability reporting guidelines](https://github.com/dotnet/dotnet-docker/blob/main/documentation/vulnerability-reporting.md). If you believe you have an issue that affects the security of .NET, please do NOT create an issue and instead email your issue details to secure@microsoft.com. - Your report may be eligible for our [bug bounty](https://www.microsoft.com/en-us/msrc/bounty-dot-net-core) but ONLY if it is reported through email. + Your report may be eligible for our [bug bounty](https://www.microsoft.com/msrc/bounty-dot-net-core) but ONLY if it is reported through email. For other types of questions, consider posting to [Discussions](https://github.com/dotnet/dotnet-docker/discussions) or [Stack Overflow](https://stackoverflow.com). diff --git a/.github/ISSUE_TEMPLATE/releases/new-distro-release.md b/.github/ISSUE_TEMPLATE/releases/new-distro-release.md index 099d381ec0..d451997d9c 100644 --- a/.github/ISSUE_TEMPLATE/releases/new-distro-release.md +++ b/.github/ISSUE_TEMPLATE/releases/new-distro-release.md @@ -27,7 +27,7 @@ assignees: lbussell 1. - [ ] Get PR signoff 1. - [ ] Merge PR to nightly branch 1. - [ ] Wait for automatically queued CI build to finish on [dotnet-docker-nightly pipeline](https://dev.azure.com/dnceng/internal/_build?definitionId=359) (internal MSFT link) -1. - [ ] Confirm READMEs have been updated in [Docker Hub](https://hub.docker.com/r/microsoft/dotnet) and the [MAR Portal](https://mcr.microsoft.com/en-us/catalog?search=dotnet) +1. - [ ] Confirm READMEs have been updated in [Docker Hub](https://hub.docker.com/r/microsoft/dotnet) and the [MAR Portal](https://mcr.microsoft.com/catalog?search=dotnet) ## Determining when to move a new distro to the main branch diff --git a/.github/ISSUE_TEMPLATE/releases/new-image-release.md b/.github/ISSUE_TEMPLATE/releases/new-image-release.md index 5c29371aa7..0690d796cb 100644 --- a/.github/ISSUE_TEMPLATE/releases/new-image-release.md +++ b/.github/ISSUE_TEMPLATE/releases/new-image-release.md @@ -38,7 +38,7 @@ title: "Add image for ___" 1. - [ ] Get PR signoff 1. - [ ] Merge PR to nightly branch 1. - [ ] Wait for automatically queued CI build to finish on [dotnet-docker-nightly pipeline](https://dev.azure.com/dnceng/internal/_build?definitionId=359) (internal MSFT link) -1. - [ ] Confirm READMEs have been updated on [MAR](https://mcr.microsoft.com/en-us/catalog?search=dotnet) and [Docker Hub](https://hub.docker.com/r/microsoft/dotnet) +1. - [ ] Confirm READMEs have been updated on [MAR](https://mcr.microsoft.com/catalog?search=dotnet) and [Docker Hub](https://hub.docker.com/r/microsoft/dotnet) ## Main Branch Tasks diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b826bd7b50..c832b142a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ Please keep in mind that the GitHub issue tracker is intended for reporting **no If you're reporting the presence of a disclosed security vulnerability, such as a CVE reported in one of our container images, please follow our documented [guidance on vulnerability reporting](https://github.com/dotnet/dotnet-docker/blob/main/documentation/vulnerability-reporting.md). If you believe you have an issue that affects the security of .NET, please do NOT create an issue and instead email your issue details to . -Your report may be eligible for our [bug bounty](https://www.microsoft.com/en-us/msrc/bounty-dot-net-core), but ONLY if it is reported through email. +Your report may be eligible for our [bug bounty](https://www.microsoft.com/msrc/bounty-dot-net-core), but ONLY if it is reported through email. ## Bugs and Feature Requests diff --git a/SECURITY.md b/SECURITY.md index c42e39492b..56d16fa79b 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,7 +8,7 @@ The .NET Core and ASP.NET Core support policy, including supported versions can Security issues and bugs should be reported privately to the Microsoft Security Response Center (MSRC), either by emailing or via the [Microsoft Security Response Center](https://msrc.microsoft.com). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your -original message. Further information, including the MSRC PGP key, can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue). +original message. Further information, including the MSRC PGP key, can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/msrc/faqs-report-an-issue). Reports via MSRC may qualify for the .NET Core Bug Bounty. Details of the .NET Core Bug Bounty including terms and conditions are at [https://aka.ms/corebounty](https://aka.ms/corebounty). diff --git a/documentation/azurelinux.md b/documentation/azurelinux.md index 80a8b32d32..4d2b5d5e84 100644 --- a/documentation/azurelinux.md +++ b/documentation/azurelinux.md @@ -153,7 +153,7 @@ COPY --from=installer /staging2/ / ## Debugging with Container Fast Mode In order to reduce image size and attack surface, Azure Linux .NET Runtime images do not contain the tools required to debug .NET apps using Visual Studio. -The easiest way to enable local Visual Studio debugging while not modifying the production image is to use [Container Fast Mode](https://learn.microsoft.com/en-us/visualstudio/containers/container-build#debugging). +The easiest way to enable local Visual Studio debugging while not modifying the production image is to use [Container Fast Mode](https://learn.microsoft.com/visualstudio/containers/container-build#debugging). To enable Container Fast Mode debugging without affecting your app's production image, you can create a new stage based off the `base` stage (called `debug` in the example) that contains the debugging tools, and then point the VS Fast Mode tools to that debug stage. @@ -214,5 +214,5 @@ COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "aspnetapp.dll"] ``` -If this example doesn't work for your scenario, see [Container Tools build properties](https://docs.microsoft.com/en-us/visualstudio/containers/container-msbuild-properties?view=vs-2022) for more information on +If this example doesn't work for your scenario, see [Container Tools build properties](https://docs.microsoft.com/visualstudio/containers/container-msbuild-properties) for more information on customizing the Fast Mode stage, or setting a custom `DockerDebuggeeKillProgram`. diff --git a/documentation/guiding-principles.md b/documentation/guiding-principles.md index 5157f258a7..32d3e9b285 100644 --- a/documentation/guiding-principles.md +++ b/documentation/guiding-principles.md @@ -40,7 +40,7 @@ See the [supported tags](supported-tags.md) for the tagging practices and polici 1. Images will be rebuilt only as necessary in order to limit downstream image rebuilds and deployments for consumers of .NET images. The [Image Update Policy](https://github.com/dotnet/dotnet-docker/blob/main/README.md#image-update-policy) section of the README contains the exact guidelines for when images will be updated. -1. Images will never be deleted from the [official .NET Docker repositories on the Microsoft Artifact Registry](https://mcr.microsoft.com/en-us/catalog?search=dotnet). This does not apply to the [nightly repositories](https://github.com/dotnet/dotnet-docker/blob/nightly/README.md). +1. Images will never be deleted from the [official .NET Docker repositories on the Microsoft Artifact Registry](https://mcr.microsoft.com/catalog?search=dotnet). This does not apply to the [nightly repositories](https://github.com/dotnet/dotnet-docker/blob/nightly/README.md). 1. The [Dockerfiles](https://github.com/search?q=repo%3Adotnet%2Fdotnet-docker+path%3A**%2FDockerfile&type=code) used to produce all of the images will be publicly available. Customers will be able to take the Dockerfiles and build them to produce their own equivalent images. No special build steps or permissions should be needed to build the Dockerfiles. diff --git a/documentation/sample-image-size-report.md b/documentation/sample-image-size-report.md index 36115a3e35..51e3520eb1 100644 --- a/documentation/sample-image-size-report.md +++ b/documentation/sample-image-size-report.md @@ -4,7 +4,7 @@ All images were produced from the ["releasesapi" sample](https://github.com/dotnet/dotnet-docker/tree/main/samples/releasesapi) using Ubuntu 22.04 ("jammy") images for amd64. Alpine images will be similar. -The Baseline image is a standard [framework-dependent](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent) deployment on the ASP.NET runtime image. +The Baseline image is a standard [framework-dependent](https://learn.microsoft.com/dotnet/core/deploying/#publish-framework-dependent) deployment on the ASP.NET runtime image. This is the largest image with the most functionality and flexibility. However, the new [Ubuntu Chiseled](https://github.com/dotnet/dotnet-docker/blob/main/documentation/ubuntu-chiseled.md) .NET base images can provide significantly smaller and more secure deployments for your application as demonstrated below. @@ -23,15 +23,15 @@ However, the new [Ubuntu Chiseled](https://github.com/dotnet/dotnet-docker/blob/ ## Self-Contained + Trimming Deployment -[Self-contained](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained) deployments bundle the .NET Runtime with your app so that it's able to run without the full .NET Runtime installed. -[IL Trimming](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained) for self-contained apps removes unused code from the .NET Runtime and libraries to reduce application size. -And [Native AOT](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/) deployment produces an app that is completely compiled to native code at build time for the smallest deployment size that .NET allows for. +[Self-contained](https://learn.microsoft.com/dotnet/core/deploying/#publish-self-contained) deployments bundle the .NET Runtime with your app so that it's able to run without the full .NET Runtime installed. +[IL Trimming](https://learn.microsoft.com/dotnet/core/deploying/trimming/trim-self-contained) for self-contained apps removes unused code from the .NET Runtime and libraries to reduce application size. +And [Native AOT](https://learn.microsoft.com/dotnet/core/deploying/native-aot/) deployment produces an app that is completely compiled to native code at build time for the smallest deployment size that .NET allows for. | Image Kind | Base Image | Uncompressed Image Size | Compressed Image Size | % Size Savings Over Baseline[^1] | | --- | --- |--- | --- | --- | -| [Self-contained](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained) + [Trimming](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained) | [`runtime-deps:8.0-jammy`](https://github.com/dotnet/dotnet-docker/blob/main/src/runtime-deps/8.0/jammy/amd64/Dockerfile) | 146 MB | 57.9 MB | 36% | -| [Chiseled](https://github.com/dotnet/dotnet-docker/blob/main/documentation/ubuntu-chiseled.md) + [Self-contained](https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained) + [Trimming](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained) | [`runtime-deps:8.0-jammy-chiseled`](https://github.com/dotnet/dotnet-docker/blob/main/src/runtime-deps/8.0/jammy-chiseled/amd64/Dockerfile)| 39.3 MB | 16.4 MB | 82% | -| [Native AOT](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/) | [`runtime-deps:8.0-jammy-chiseled`](https://github.com/dotnet/dotnet-docker/blob/main/src/runtime-deps/8.0/jammy-chiseled/amd64/Dockerfile)| 27.7 MB | 12.4 MB | 86% | +| [Self-contained](https://learn.microsoft.com/dotnet/core/deploying/#publish-self-contained) + [Trimming](https://learn.microsoft.com/dotnet/core/deploying/trimming/trim-self-contained) | [`runtime-deps:8.0-jammy`](https://github.com/dotnet/dotnet-docker/blob/main/src/runtime-deps/8.0/jammy/amd64/Dockerfile) | 146 MB | 57.9 MB | 36% | +| [Chiseled](https://github.com/dotnet/dotnet-docker/blob/main/documentation/ubuntu-chiseled.md) + [Self-contained](https://learn.microsoft.com/dotnet/core/deploying/#publish-self-contained) + [Trimming](https://learn.microsoft.com/dotnet/core/deploying/trimming/trim-self-contained) | [`runtime-deps:8.0-jammy-chiseled`](https://github.com/dotnet/dotnet-docker/blob/main/src/runtime-deps/8.0/jammy-chiseled/amd64/Dockerfile)| 39.3 MB | 16.4 MB | 82% | +| [Native AOT](https://learn.microsoft.com/dotnet/core/deploying/native-aot/) | [`runtime-deps:8.0-jammy-chiseled`](https://github.com/dotnet/dotnet-docker/blob/main/src/runtime-deps/8.0/jammy-chiseled/amd64/Dockerfile)| 27.7 MB | 12.4 MB | 86% | For more information on .NET image variants and AOT images, please see the following documentation: diff --git a/documentation/vulnerability-reporting.md b/documentation/vulnerability-reporting.md index 08b9ff14ad..2bff07bca2 100644 --- a/documentation/vulnerability-reporting.md +++ b/documentation/vulnerability-reporting.md @@ -79,7 +79,7 @@ If the script above returns an error indicating it's unable to resolve a multi-a The following scripts indicate how to do that. If you're targeting Windows containers, you'll need to determine the Windows build number of the image you're targeting. -To do this, find the Windows version number that is listed on the [Windows Docker Hub page](https://mcr.microsoft.com/en-us/product/windows/nanoserver/about). +To do this, find the Windows version number that is listed on the [Windows Docker Hub page](https://mcr.microsoft.com/artifact/mar/windows/nanoserver/about). For example, if you're targeting Windows Server 2022 LTSC, look for the `ltsc2022` tag and find its corresponding build number in the OS Version column. You only need the first three parts of the version number. In the case of Windows Server 2022, it's `10.0.20348`. @@ -133,7 +133,7 @@ The simple rule to follow: only the tags shown in our full tag listings are supp * [monitor-base](../README.monitor-base.md#full-tag-listing) * [aspire-dashboard](../README.aspire-dashboard.md#full-tag-listing) * [samples](../README.samples.md#full-tag-listing) -* [Microsoft Artifact Registry](https://mcr.microsoft.com/en-us/catalog?search=dotnet/) +* [Microsoft Artifact Registry](https://mcr.microsoft.com/catalog?search=dotnet/) #### Image Lifecycle Annotations diff --git a/eng/common/templates/jobs/cg-build-projects.yml b/eng/common/templates/jobs/cg-build-projects.yml index de372c4c48..c26e40972e 100644 --- a/eng/common/templates/jobs/cg-build-projects.yml +++ b/eng/common/templates/jobs/cg-build-projects.yml @@ -7,7 +7,7 @@ parameters: type: boolean default: false displayName: CG Dry Run -# See https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#options for possible Channel values +# See https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script#options for possible Channel values - name: dotnetVersionChannel type: string default: '9.0' diff --git a/eng/dockerfile-templates/Dockerfile.linux.download-files b/eng/dockerfile-templates/Dockerfile.linux.download-files index 890a112a3c..f03fc52b80 100644 --- a/eng/dockerfile-templates/Dockerfile.linux.download-files +++ b/eng/dockerfile-templates/Dockerfile.linux.download-files @@ -10,7 +10,7 @@ ^ _ Documentation for using Managed Identity/OAuth tokens to access Azure storage accounts: - https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens ^ + https://learn.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens ^ for i, file in ARGS["files"]:{{ if (find(file["url"], "dotnetstage") >= 0):{{ diff --git a/eng/dockerfile-templates/Dockerfile.windows.download-files b/eng/dockerfile-templates/Dockerfile.windows.download-files index 0780023346..da6e26fe15 100644 --- a/eng/dockerfile-templates/Dockerfile.windows.download-files +++ b/eng/dockerfile-templates/Dockerfile.windows.download-files @@ -10,7 +10,7 @@ ^ _ Documentation for using Managed Identity/OAuth tokens to access Azure storage accounts: - https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens ^ + https://learn.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens ^ set isInternal(url) to:{{ return find(url, "dotnetstage") >= 0 diff --git a/eng/shared/.editorconfig b/eng/shared/.editorconfig index 3d267e16c2..46a15adc27 100644 --- a/eng/shared/.editorconfig +++ b/eng/shared/.editorconfig @@ -1,5 +1,5 @@ [*.cs] # CS1591: Missing XML comment for publicly visible type or member -# https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs1591 +# https://learn.microsoft.com/dotnet/csharp/language-reference/compiler-messages/cs1591 # Since this is a shared project, public members should be documented. dotnet_diagnostic.CS1591.severity = suggestion diff --git a/eng/update-dependencies/AzdoAuthProvider.cs b/eng/update-dependencies/AzdoAuthProvider.cs index c202b64ceb..b85465e18d 100644 --- a/eng/update-dependencies/AzdoAuthProvider.cs +++ b/eng/update-dependencies/AzdoAuthProvider.cs @@ -14,7 +14,7 @@ public class AzdoAuthProvider /// This scope provides access to Azure DevOps Services REST API. /// /// - /// See https://learn.microsoft.com/en-us/rest/api/azure/devops/tokens/?view=azure-devops-rest-7.1&tabs=powershell#personal-access-tokens-pats + /// See https://learn.microsoft.com/rest/api/azure/devops/tokens/?view=azure-devops-rest-7.1&tabs=powershell#personal-access-tokens-pats /// options.JsonSerializerOptions.TypeInfoResolverChain.Add(SampleAppJsonSerializerContext.Default)); @@ -54,7 +54,7 @@ app.Run(); // Enable source generated JSON serialization -// https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation#source-generation-support-in-aspnet-core +// https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/source-generation#source-generation-support-in-aspnet-core [JsonSerializable(typeof(EnvironmentInfo))] [JsonSerializable(typeof(Operation))] internal partial class SampleAppJsonSerializerContext : JsonSerializerContext { } diff --git a/samples/build-in-sdk-container.md b/samples/build-in-sdk-container.md index d5bf6759bc..6a893813e2 100644 --- a/samples/build-in-sdk-container.md +++ b/samples/build-in-sdk-container.md @@ -65,7 +65,7 @@ These instructions assume that you have cloned the repository locally, and that This scenario relies on [volume mounting](https://docs.docker.com/engine/admin/volumes/volumes/) (that's the `-v` argument) to make source available within the container (to build it). You may need to enable [shared drives (Windows)](https://docs.docker.com/docker-for-windows/#shared-drives) or [file sharing (macOS)](https://docs.docker.com/docker-for-mac/#file-sharing) first. -`dotnet publish` (and `build`) produces native executables for applications. If you use a Linux container, you will build a Linux executable that will not run on Windows or macOS. You can use a [runtime argument](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog) (`-r`) to specify the type of assets that you want to publish (if they don't match the SDK container). The following examples assume you want assets that match your host operating system, and use runtime arguments to ensure that. +`dotnet publish` (and `build`) produces native executables for applications. If you use a Linux container, you will build a Linux executable that will not run on Windows or macOS. You can use a [runtime argument](https://docs.microsoft.com/dotnet/core/rid-catalog) (`-r`) to specify the type of assets that you want to publish (if they don't match the SDK container). The following examples assume you want assets that match your host operating system, and use runtime arguments to ensure that. ### Pull SDK image @@ -137,7 +137,7 @@ docker run --rm -v ${pwd}:c:\app -w c:\app mcr.microsoft.com/dotnet/sdk:9.0-nano ``` > [!WARNING] -> From .NET 8 onwards, [.NET multi-platform images are Linux-only](https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/8.0/multi-platform-tags). +> From .NET 8 onwards, [.NET multi-platform images are Linux-only](https://learn.microsoft.com/dotnet/core/compatibility/containers/8.0/multi-platform-tags). > This means Windows containers must all be referenced by a full tag name including the specific Windows version. You can see the built binaries with the following command: diff --git a/samples/deploy-container-to-aci.md b/samples/deploy-container-to-aci.md index bc1801a8fb..7393873a5a 100644 --- a/samples/deploy-container-to-aci.md +++ b/samples/deploy-container-to-aci.md @@ -2,7 +2,7 @@ You can deploy ASP.NET Core applications to Azure Container Instances (ACI) with Docker. ACI is a great option for application testing and can also be used for production deployment (not covered here). These instructions are based on the [ASP.NET Core Docker Sample](README.md). -These instructions work for both Linux and Windows based images. Be aware that ACI does not support all versions of Windows images. See [What Windows base OS images are supported](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-faq#what-windows-base-os-images-are-supported) for details. +These instructions work for both Linux and Windows based images. Be aware that ACI does not support all versions of Windows images. See [What Windows base OS images are supported](https://docs.microsoft.com/azure/container-instances/container-instances-faq#what-windows-base-os-images-are-supported) for details. ## Build Application diff --git a/samples/dotnetapp/README.md b/samples/dotnetapp/README.md index f9999f77ae..8122ad1988 100644 --- a/samples/dotnetapp/README.md +++ b/samples/dotnetapp/README.md @@ -4,7 +4,7 @@ This sample demonstrates how to build container images for .NET console apps. Se ## Run the sample image -You can start by launching a sample from our [container registry](https://mcr.microsoft.com/product/dotnet/samples/about). +You can start by launching a sample from our [container registry](https://mcr.microsoft.com/artifact/mar/dotnet/samples/about). ```console docker run --rm mcr.microsoft.com/dotnet/samples:dotnetapp-chiseled diff --git a/samples/dotnetapp/dotnetapp.csproj b/samples/dotnetapp/dotnetapp.csproj index 83933833bb..80acd4831f 100644 --- a/samples/dotnetapp/dotnetapp.csproj +++ b/samples/dotnetapp/dotnetapp.csproj @@ -9,7 +9,7 @@ + https://learn.microsoft.com/dotnet/core/containers/overview --> true diff --git a/samples/host-aspnetcore-https.md b/samples/host-aspnetcore-https.md index abc2e5cd41..06686079c8 100644 --- a/samples/host-aspnetcore-https.md +++ b/samples/host-aspnetcore-https.md @@ -2,7 +2,7 @@ ASP.NET Core uses [HTTPS by default](https://docs.microsoft.com/aspnet/core/security/enforcing-ssl). [HTTPS](https://en.wikipedia.org/wiki/HTTPS) relies on [certificates](https://en.wikipedia.org/wiki/Public_key_certificate) for trust, identity, and encryption. -See [Hosting ASP.NET Core images with Docker over HTTPS](https://learn.microsoft.com/en-us/aspnet/core/security/docker-https) for [HTTPS](https://en.wikipedia.org/wiki/HTTPS) scenarios +See [Hosting ASP.NET Core images with Docker over HTTPS](https://learn.microsoft.com/aspnet/core/security/docker-https) for [HTTPS](https://en.wikipedia.org/wiki/HTTPS) scenarios ## Get certificates into a container diff --git a/samples/kubernetes/graceful-shutdown/graceful-shutdown.md b/samples/kubernetes/graceful-shutdown/graceful-shutdown.md index eaaaadc19e..2342cd91f7 100644 --- a/samples/kubernetes/graceful-shutdown/graceful-shutdown.md +++ b/samples/kubernetes/graceful-shutdown/graceful-shutdown.md @@ -18,7 +18,7 @@ Changing the `HostOptions.ShutdownTimeout` is the simplest way to modify the app In general, it is better to avoid situations where a network request takes a long time to process (several seconds or more). These kinds of requests tend to limit application scalability and are prone to failing due to network connection errors and client timeouts. It is better, if possible, to replace a long-running requests with a pair of related requests: the first request starts the operation, and the second request allows the client to ask for the result. If this is not feasible, you can make long-running requests cancel work promptly (and avoid being aborted by the ASP.NET host) by leveraging the `CancellationToken` that is associated with `ApplicationStopping` event. -Any ASP.NET request handler [can take a `CancellationToken` as a parameter](https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis/parameter-binding?view=aspnetcore-7.0#special-types). This `CancellationToken` is automatically created by ASP.NET and will be activated when the request is cancelled by the client. By default, the same `CancellationToken` will NOT be activated when `ApplicationStopping` event is raised, but you can create a "linked" `CancellationToken` to cover both cases. Here is how to do it with ASP.NET minimal API framework: +Any ASP.NET request handler [can take a `CancellationToken` as a parameter](https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis/parameter-binding#special-types). This `CancellationToken` is automatically created by ASP.NET and will be activated when the request is cancelled by the client. By default, the same `CancellationToken` will NOT be activated when `ApplicationStopping` event is raised, but you can create a "linked" `CancellationToken` to cover both cases. Here is how to do it with ASP.NET minimal API framework: ```csharp app.Map("/longop/{value}", async Task>> (int value, CancellationToken requestCt, [FromServices] IHostApplicationLifetime hostLifetime) => @@ -29,13 +29,13 @@ app.Map("/longop/{value}", async Task>> { // Simulates long processing... await Task.Delay(value * 1000, effectiveCt); - } + } catch (OperationCanceledException) { // Will happen if client cancels the request OR when the app is shutting down. return TypedResults.StatusCode(StatusCodes.Status503ServiceUnavailable); } - + return TypedResults.Ok($"Worked {value} seconds, looks good"); }); ``` @@ -70,7 +70,7 @@ public class DelayedShutdownHostLifetime : IHostLifetime, IDisposable private TimeSpan _delay; private IEnumerable? _disposables; - public DelayedShutdownHostLifetime(IHostApplicationLifetime applicationLifetime, TimeSpan delay) { + public DelayedShutdownHostLifetime(IHostApplicationLifetime applicationLifetime, TimeSpan delay) { _applicationLifetime = applicationLifetime; _delay = delay; } @@ -99,9 +99,9 @@ public class DelayedShutdownHostLifetime : IHostLifetime, IDisposable public void Dispose() { - foreach (var disposable in _disposables ?? Enumerable.Empty()) + foreach (var disposable in _disposables ?? Enumerable.Empty()) { - disposable.Dispose(); + disposable.Dispose(); } } } @@ -114,7 +114,7 @@ Make ASP.NET use `DelayedShutdownHostLifetime` by adding it to the dependency in ```csharp builder.Services.AddSingleton(sp => new DelayedShutdownHostLifetime( - sp.GetRequiredService(), + sp.GetRequiredService(), TimeSpan.FromSeconds(5) // ... or whatever delay is appropriate for your service. )); ``` @@ -127,4 +127,4 @@ For background services ASP.NET provides [`IHostedService` interface and a `Back - If you are using `BackgroundService` base class, the `CancellationToken` passed to [`ExecuteAsync` method](https://learn.microsoft.com/aspnet/core/fundamentals/host/hosted-services?#backgroundservice-base-class) will be activated if `ApplicationStopping` event occurs. So as long as you are using this token, or a token derived from it, for all asynchronous calls, they will be automatically cancelled upon application shutdown. -- If you are implementing `IHostedService` interface directly, make sure you cancel all background processing when the framework calls [`StopAsync` method](https://learn.microsoft.com/aspnet/core/fundamentals/host/hosted-services?#stopasync) on your service. This usually means you need to keep a reference, or a `CancellationTokenSource`, for all background tasks in progress, so that you can cancel them when `StopAsync` is called. +- If you are implementing `IHostedService` interface directly, make sure you cancel all background processing when the framework calls [`StopAsync` method](https://learn.microsoft.com/aspnet/core/fundamentals/host/hosted-services#stopasync) on your service. This usually means you need to keep a reference, or a `CancellationTokenSource`, for all background tasks in progress, so that you can cancel them when `StopAsync` is called. diff --git a/samples/run-aspnetcore-https-development.md b/samples/run-aspnetcore-https-development.md index e1b1a5da7b..1257167454 100644 --- a/samples/run-aspnetcore-https-development.md +++ b/samples/run-aspnetcore-https-development.md @@ -4,7 +4,7 @@ ASP.NET Core uses [HTTPS by default](https://docs.microsoft.com/aspnet/core/secu This document demonstrates how to develop ASP.NET Core applications with HTTPS in Docker containers. It's recommended to try the [ASP.NET Core Docker Sample](README.md) first, which is simpler because the container only exposes HTTP. This more basic tutorial will help you validate that you have the sample working correctly, before adding the complication of certificates. -See [Hosting ASP.NET Core images with Docker over HTTPS](https://learn.microsoft.com/en-us/aspnet/core/security/docker-https) for production scenarios. +See [Hosting ASP.NET Core images with Docker over HTTPS](https://learn.microsoft.com/aspnet/core/security/docker-https) for production scenarios. Windows instructions are written for PowerShell. If you are using CMD, change the format of environment variables from `${env:USERPROFILE}` to `%USERPROFILE%`. diff --git a/tests/Microsoft.DotNet.Docker.Tests/TestAppArtifacts/NLSTest.cs b/tests/Microsoft.DotNet.Docker.Tests/TestAppArtifacts/NLSTest.cs index 43126502de..42d173adf6 100644 --- a/tests/Microsoft.DotNet.Docker.Tests/TestAppArtifacts/NLSTest.cs +++ b/tests/Microsoft.DotNet.Docker.Tests/TestAppArtifacts/NLSTest.cs @@ -15,7 +15,7 @@ throw new Exception($"ICU mode detected as {icuMode}, expected {icuExpected}"); } -// https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#stringendswith +// https://learn.microsoft.com/dotnet/core/extensions/globalization-icu#stringendswith Assert( """ "abc".EndsWith("\0")""", "abc".EndsWith("\0").ToString(), @@ -29,7 +29,7 @@ nlsResult: false.ToString(), icuMode); -// https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#stringstartswith +// https://learn.microsoft.com/dotnet/core/extensions/globalization-icu#stringstartswith Assert( """ "foo".StartsWith("\0")""", "foo".StartsWith("\0").ToString(), @@ -43,7 +43,7 @@ nlsResult: false.ToString(), icuMode); -// https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#stringindexof +// https://learn.microsoft.com/dotnet/core/extensions/globalization-icu#stringindexof Assert( """ "Hel\0lo".IndexOf("\0")""", "Hel\0lo".IndexOf("\0").ToString(), @@ -59,7 +59,7 @@ WriteLine("All assertions passed!"); -// https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#determine-if-your-app-is-using-icu +// https://learn.microsoft.com/dotnet/core/extensions/globalization-icu#determine-if-your-app-is-using-icu bool IsIcuMode() { SortVersion sortVersion = CultureInfo.InvariantCulture.CompareInfo.Version; diff --git a/tests/run-tests.ps1 b/tests/run-tests.ps1 index 48b1e05880..78e1238440 100644 --- a/tests/run-tests.ps1 +++ b/tests/run-tests.ps1 @@ -132,7 +132,7 @@ Try { if ($TestCategories) { # Construct an expression that filters the test to each of the # selected TestCategories (using an OR operator between each category). - # See https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests + # See https://docs.microsoft.com/dotnet/core/testing/selective-unit-tests $TestCategories | ForEach-Object { if ($testFilter) { $testFilter += "|"