You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/host-and-deploy/webassembly/bundle-caching-and-integrity-check-failures.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,7 @@ Placeholders:
152
152
>
153
153
> 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.
154
154
>
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/).
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/best-practices.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ author: mjrousos
4
4
description: Tips for maximizing performance and reliability in ASP.NET Core apps.
5
5
monikerRange: '>= aspnetcore-2.1'
6
6
ms.author: tdykstra
7
-
ms.date: 12/20/2022
7
+
ms.date: 12/29/2025
8
8
uid: fundamentals/best-practices
9
9
---
10
10
# ASP.NET Core Best Practices
@@ -39,7 +39,7 @@ A common performance problem in ASP.NET Core apps is blocking calls that could b
39
39
***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.
40
40
***Consider** using message brokers like [Azure Service Bus](/azure/service-bus-messaging/service-bus-messaging-overview) to offload long-running calls
41
41
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.
43
43
44
44
## Return large collections across multiple smaller pages
45
45
@@ -54,7 +54,7 @@ A webpage shouldn't load large amounts of data all at once. When returning a col
54
54
55
55
For more information on paging and limiting the number of returned records, see:
*[Add paging to an ASP.NET Core app](xref:data/ef-rp/sort-filter-page#add-paging)
59
59
60
60
### Return `IEnumerable<T>` or `IAsyncEnumerable<T>`
@@ -186,7 +186,7 @@ In the preceding code, `Get` synchronously reads the entire HTTP request body in
186
186
The preceding code asynchronously reads the entire HTTP request body into memory.
187
187
188
188
> [!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.
190
190
191
191
**Do this:** The following example is fully asynchronous using a non-buffered request body:
192
192
@@ -202,7 +202,7 @@ Use `HttpContext.Request.ReadFormAsync` instead of `HttpContext.Request.Form`.
202
202
* The form has been read by a call to `ReadFormAsync`, and
203
203
* The cached form value is being read using `HttpContext.Request.Form`
204
204
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.
@@ -230,12 +230,12 @@ Storing a large request or response body into a single `byte[]` or `string`:
230
230
231
231
## Working with a synchronous data processing API
232
232
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)):
234
234
235
235
* Buffer the data into memory asynchronously before passing it into the serializer/de-serializer.
236
236
237
237
> [!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.
239
239
240
240
ASP.NET Core 3.0 uses <xref:System.Text.Json> by default for JSON serialization. <xref:System.Text.Json>:
241
241
@@ -308,7 +308,7 @@ Background tasks should be implemented as hosted services. For more information,
308
308
309
309
## Do not capture services injected into the controllers on background threads
310
310
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`.
Copy file name to clipboardExpand all lines: aspnetcore/grpc/performance.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -241,7 +241,7 @@ Server streaming calls don't have a request stream. This means that the only way
241
241
242
242
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.
243
243
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.
Copy file name to clipboardExpand all lines: aspnetcore/host-and-deploy/linux-nginx.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -377,7 +377,7 @@ Close off all external ports that aren't in use. Uncomplicated firewall (ufw) pr
377
377
# [Ubuntu](#tab/linux-ubuntu)
378
378
379
379
> [!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).
381
381
382
382
Install `ufw` and configure it to allow traffic on any ports needed.
Copy file name to clipboardExpand all lines: aspnetcore/host-and-deploy/linux-nginx/includes/linux-nginx5.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -314,7 +314,7 @@ Linux Security Modules (LSM) is a framework that's part of the Linux kernel sinc
314
314
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.
315
315
316
316
> [!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).
318
318
319
319
Install `ufw` and configure it to allow traffic on any ports needed.
320
320
@@ -760,7 +760,7 @@ Linux Security Modules (LSM) is a framework that's part of the Linux kernel sinc
760
760
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.
761
761
762
762
> [!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).
764
764
765
765
Install `ufw` and configure it to allow traffic on any ports needed.
Copy file name to clipboardExpand all lines: aspnetcore/migration/fx-to-core/examples/configuration.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Migrate configuration to ASP.NET Core
3
3
author: wadepickett
4
4
description: Learn how to migrate configuration from an ASP.NET MVC project to an ASP.NET Core MVC project.
5
5
ms.author: wpickett
6
-
ms.date: 10/14/2016
6
+
ms.date: 12/30/2025
7
7
uid: migration/fx-to-core/examples/configuration
8
8
ms.sfi.ropc: t
9
9
---
@@ -12,7 +12,7 @@ ms.sfi.ropc: t
12
12
13
13
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.
14
14
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))
0 commit comments