Skip to content

Commit 298bd28

Browse files
authored
Merge pull request #36555 from dotnet/main
Merge to Live
2 parents a57b1bf + 4c3534a commit 298bd28

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

aspnetcore/blazor/host-and-deploy/webassembly/bundle-caching-and-integrity-check-failures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Placeholders:
152152
>
153153
> If you have any cause for concern that checksum validation isn't secure enough in your environment, consult your organization's security leadership for guidance.
154154
>
155-
> For more information, see [Overview of threat protection by Microsoft Defender Antivirus](/microsoft-365/business-premium/m365bp-threats-detected-defender-av).
155+
> For more information, see [Microsoft Defender for Business](/defender-business/).
156156
157157
:::moniker-end
158158

aspnetcore/fundamentals/best-practices.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: mjrousos
44
description: Tips for maximizing performance and reliability in ASP.NET Core apps.
55
monikerRange: '>= aspnetcore-2.1'
66
ms.author: tdykstra
7-
ms.date: 12/20/2022
7+
ms.date: 12/29/2025
88
uid: fundamentals/best-practices
99
---
1010
# ASP.NET Core Best Practices
@@ -39,7 +39,7 @@ A common performance problem in ASP.NET Core apps is blocking calls that could b
3939
* **Do** make controller/Razor Page actions asynchronous. The entire call stack is asynchronous in order to benefit from [async/await](/dotnet/csharp/programming-guide/concepts/async/) patterns.
4040
* **Consider** using message brokers like [Azure Service Bus](/azure/service-bus-messaging/service-bus-messaging-overview) to offload long-running calls
4141

42-
A profiler, such as [PerfView](https://github.com/Microsoft/perfview), can be used to find threads frequently added to the [Thread Pool](/windows/desktop/procthread/thread-pools). The `Microsoft-Windows-DotNETRuntime/ThreadPoolWorkerThread/Start` event indicates a thread added to the thread pool. <!-- For more information, see [async guidance docs](TBD-Link_To_Davifowl_Doc) -->
42+
A profiler, such as [PerfView](https://github.com/Microsoft/perfview), can be used to find threads frequently added to the [Thread Pool](/windows/desktop/procthread/thread-pools). The `Microsoft-Windows-DotNETRuntime/ThreadPoolWorkerThread/Start` event indicates a thread added to the thread pool.
4343

4444
## Return large collections across multiple smaller pages
4545

@@ -54,7 +54,7 @@ A webpage shouldn't load large amounts of data all at once. When returning a col
5454

5555
For more information on paging and limiting the number of returned records, see:
5656

57-
* [Performance considerations](xref:data/ef-rp/intro#performance-considerations)
57+
* [Performance considerations](xref:data/ef-rp/intro#performance-considerations)
5858
* [Add paging to an ASP.NET Core app](xref:data/ef-rp/sort-filter-page#add-paging)
5959

6060
### Return `IEnumerable<T>` or `IAsyncEnumerable<T>`
@@ -186,7 +186,7 @@ In the preceding code, `Get` synchronously reads the entire HTTP request body in
186186
The preceding code asynchronously reads the entire HTTP request body into memory.
187187

188188
> [!WARNING]
189-
> If the request is large, reading the entire HTTP request body into memory could lead to an out of memory (OOM) condition. OOM can result in a Denial Of Service. For more information, see [Avoid reading large request bodies or response bodies into memory](#arlb) in this article.
189+
> If the request is large, reading the entire HTTP request body into memory could lead to an out of memory (OOM) condition. OOM can result in a Denial Of Service. For more information, see [Avoid reading large request bodies or response bodies into memory](#arlb) in this article.
190190
191191
**Do this:** The following example is fully asynchronous using a non-buffered request body:
192192

@@ -202,7 +202,7 @@ Use `HttpContext.Request.ReadFormAsync` instead of `HttpContext.Request.Form`.
202202
* The form has been read by a call to `ReadFormAsync`, and
203203
* The cached form value is being read using `HttpContext.Request.Form`
204204

205-
**Do not do this:** The following example uses `HttpContext.Request.Form`. `HttpContext.Request.Form` uses [sync over async](https://devblogs.microsoft.com/pfxteam/should-i-expose-synchronous-wrappers-for-asynchronous-methods/) and can lead to thread pool starvation.
205+
**Do not do this:** The following example uses `HttpContext.Request.Form`. `HttpContext.Request.Form` uses [sync over async](https://devblogs.microsoft.com/pfxteam/should-i-expose-synchronous-wrappers-for-asynchronous-methods/) and can lead to thread pool starvation.
206206

207207
[!code-csharp[](~/performance/performance-best-practices/samples/3.0/Controllers/MySecondController.cs?name=snippet1)]
208208

@@ -230,12 +230,12 @@ Storing a large request or response body into a single `byte[]` or `string`:
230230

231231
## Working with a synchronous data processing API
232232

233-
When using a serializer/de-serializer that only supports synchronous reads and writes (for example, [Json.NET](https://www.newtonsoft.com/json/help/html/Introduction.htm)):
233+
When using a serializer/de-serializer that only supports synchronous reads and writes (for example, [Json.NET](https://www.newtonsoft.com/json/help/html/Introduction.htm)):
234234

235235
* Buffer the data into memory asynchronously before passing it into the serializer/de-serializer.
236236

237237
> [!WARNING]
238-
> If the request is large, it could lead to an out of memory (OOM) condition. OOM can result in a Denial Of Service. For more information, see [Avoid reading large request bodies or response bodies into memory](#arlb) in this article.
238+
> If the request is large, it could lead to an out of memory (OOM) condition. OOM can result in a Denial Of Service. For more information, see [Avoid reading large request bodies or response bodies into memory](#arlb) in this article.
239239
240240
ASP.NET Core 3.0 uses <xref:System.Text.Json> by default for JSON serialization. <xref:System.Text.Json>:
241241

@@ -308,7 +308,7 @@ Background tasks should be implemented as hosted services. For more information,
308308

309309
## Do not capture services injected into the controllers on background threads
310310

311-
**Do not do this:** The following example shows a closure that is capturing the `DbContext` from the `Controller` action parameter. This is a bad practice. The work item could run outside of the request scope. The `ContosoDbContext` is scoped to the request, resulting in an `ObjectDisposedException`.
311+
**Do not do this:** The following example shows a closure that is capturing the `DbContext` from the `Controller` action parameter. This is a bad practice. The work item could run outside of the request scope. The `ContosoDbContext` is scoped to the request, resulting in an `ObjectDisposedException`.
312312

313313
[!code-csharp[](~/performance/performance-best-practices/samples/3.0/Controllers/FireAndForgetSecondController.cs?name=snippet1)]
314314

aspnetcore/grpc/performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Server streaming calls don't have a request stream. This means that the only way
241241

242242
Always dispose streaming calls once they're no longer needed. The type returned when starting streaming calls implements `IDisposable`. Disposing a call once it is no longer needed ensures it is stopped and all resources are cleaned up.
243243

244-
In the following example, the [using declaration](/dotnet/csharp/language-reference/proposals/csharp-8.0/using#using-declaration) on the `AccumulateCount()` call ensures it's always disposed if an unexpected error occurs.
244+
In the following example, the [using declaration](/dotnet/csharp/language-reference/keywords/using-directive) on the `AccumulateCount()` call ensures it's always disposed if an unexpected error occurs.
245245

246246
[!code-csharp[](~/grpc/performance/dispose-streaming-call.cs?highlight=2)]
247247

aspnetcore/host-and-deploy/linux-nginx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ Close off all external ports that aren't in use. Uncomplicated firewall (ufw) pr
377377
# [Ubuntu](#tab/linux-ubuntu)
378378

379379
> [!WARNING]
380-
> A firewall prevents access to the whole system if not configured correctly. Failure to specify the correct SSH port effectively locks you out of the system if you are using SSH to connect to it. The default port is 22. For more information, see the [introduction to ufw](https://help.ubuntu.com/community/UFW) and the [manual](https://manpages.ubuntu.com/manpages/lunar/en/man8/ufw.8.html).
380+
> A firewall prevents access to the whole system if not configured correctly. Failure to specify the correct SSH port effectively locks you out of the system if you are using SSH to connect to it. The default port is 22. For more information, see the [introduction to ufw](https://help.ubuntu.com/community/UFW) and the [manual](https://manpages.ubuntu.com/manpages/resolute/man8/ufw.8.html).
381381
382382
Install `ufw` and configure it to allow traffic on any ports needed.
383383

aspnetcore/host-and-deploy/linux-nginx/includes/linux-nginx5.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Linux Security Modules (LSM) is a framework that's part of the Linux kernel sinc
314314
Close off all external ports that aren't in use. Uncomplicated firewall (ufw) provides a front end for `iptables` by providing a CLI for configuring the firewall.
315315

316316
> [!WARNING]
317-
> A firewall will prevent access to the whole system if not configured correctly. Failure to specify the correct SSH port will effectively lock you out of the system if you are using SSH to connect to it. The default port is 22. For more information, see the [introduction to ufw](https://help.ubuntu.com/community/UFW) and the [manual](https://manpages.ubuntu.com/manpages/lunar/en/man8/ufw.8.html).
317+
> A firewall will prevent access to the whole system if not configured correctly. Failure to specify the correct SSH port will effectively lock you out of the system if you are using SSH to connect to it. The default port is 22. For more information, see the [introduction to ufw](https://help.ubuntu.com/community/UFW) and the [manual](https://manpages.ubuntu.com/manpages/resolute/man8/ufw.8.html).
318318
319319
Install `ufw` and configure it to allow traffic on any ports needed.
320320

@@ -760,7 +760,7 @@ Linux Security Modules (LSM) is a framework that's part of the Linux kernel sinc
760760
Close off all external ports that aren't in use. Uncomplicated firewall (ufw) provides a front end for `iptables` by providing a CLI for configuring the firewall.
761761

762762
> [!WARNING]
763-
> A firewall will prevent access to the whole system if not configured correctly. Failure to specify the correct SSH port will effectively lock you out of the system if you are using SSH to connect to it. The default port is 22. For more information, see the [introduction to ufw](https://help.ubuntu.com/community/UFW) and the [manual](https://manpages.ubuntu.com/manpages/lunar/en/man8/ufw.8.html).
763+
> A firewall will prevent access to the whole system if not configured correctly. Failure to specify the correct SSH port will effectively lock you out of the system if you are using SSH to connect to it. The default port is 22. For more information, see the [introduction to ufw](https://help.ubuntu.com/community/UFW) and the [manual](https://manpages.ubuntu.com/manpages/resolute/man8/ufw.8.html).
764764
765765
Install `ufw` and configure it to allow traffic on any ports needed.
766766

aspnetcore/migration/fx-to-core/examples/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Migrate configuration to ASP.NET Core
33
author: wadepickett
44
description: Learn how to migrate configuration from an ASP.NET MVC project to an ASP.NET Core MVC project.
55
ms.author: wpickett
6-
ms.date: 10/14/2016
6+
ms.date: 12/30/2025
77
uid: migration/fx-to-core/examples/configuration
88
ms.sfi.ropc: t
99
---
@@ -12,7 +12,7 @@ ms.sfi.ropc: t
1212

1313
In the previous article, we began to [migrate an ASP.NET MVC project to ASP.NET Core MVC](overview.md). In this article, we migrate configuration.
1414

15-
[View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/migration/fx-to-core/examples/configuration/samples) ([how to download](xref:fundamentals/index#how-to-download-a-sample))
15+
[View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/migration/fx-to-core/examples/samples/configuration) ([how to download](xref:fundamentals/index#how-to-download-a-sample))
1616

1717
## Setup configuration
1818

0 commit comments

Comments
 (0)