Skip to content

Commit 7347d00

Browse files
authored
Merge pull request #36468 from dotnet/main
Merge to Live
2 parents e88ffbf + 10cd976 commit 7347d00

File tree

5 files changed

+138
-36
lines changed

5 files changed

+138
-36
lines changed

aspnetcore/blazor/components/js-spa-frameworks.md

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ This article covers how to render Razor components from JavaScript, use Blazor c
2020
<!-- UPDATE 11.0 - The `blazor.web.js` (Blazor Web App) portions of
2121
this article have been commented out for the time being to
2222
facilitate reconstituting the guidance later when support lands.
23-
It was under consideration for .NET 10 on
24-
https://github.com/dotnet/AspNetCore.Docs/issues/35653, but
25-
it didn't make the cut and was backlogged. -->
23+
The PU work is tracked by https://github.com/dotnet/aspnetcore/issues/53920. -->
2624

2725
## Angular sample apps
2826

29-
<!-- UPDATE 10.0 Add migration instructions for 9.0 to 10.0 -->
27+
The following sample apps demonstrate rendering a Razor component as a [Blazor custom element](#blazor-custom-elements) in an Angular app:
3028

31-
* [CustomElementsBlazorSample (Blazor Server) (`javiercn/CustomElementsBlazorSample`, branch: `blazor-server`)](https://github.com/javiercn/CustomElementsBlazorSample/tree/blazor-server): Blazor Server is supported in .NET 8/9. To migrate this .NET 7 sample, see <xref:migration/70-to-80#update-a-blazor-server-app> and <xref:migration/80-to-90>.
32-
* [CustomElementsBlazorSample (Blazor WebAssembly) (`javiercn/CustomElementsBlazorSample`, branch: `blazor-wasm`)](https://github.com/javiercn/CustomElementsBlazorSample/tree/blazor-wasm): To migrate this .NET 7 sample, see <xref:migration/70-to-80#update-a-blazor-webassembly-app> and <xref:migration/80-to-90>.
29+
* [CustomElementsBlazorSample (Blazor Server) (`javiercn/CustomElementsBlazorSample` GitHub repository, branch: `blazor-server`)](https://github.com/javiercn/CustomElementsBlazorSample/tree/blazor-server)
30+
* [CustomElementsBlazorSample (Blazor WebAssembly) (`javiercn/CustomElementsBlazorSample` GitHub repository, branch: `blazor-wasm`)](https://github.com/javiercn/CustomElementsBlazorSample/tree/blazor-wasm)
31+
32+
To migrate either of these .NET 7 samples, see the following resources:
33+
34+
* <xref:migration/70-to-80>
35+
* <xref:migration/80-to-90>
36+
* <xref:migration/90-to-100>
37+
38+
The principal updates to make are:
39+
40+
* Update the [target framework monikers (TFMs)](/dotnet/standard/frameworks) to the latest version.
41+
* Update the .NET package references and Angular dependencies to their latest versions.
42+
43+
[!INCLUDE[](~/includes/package-reference.md)]
3344

3445
## Render Razor components from JavaScript
3546

@@ -340,24 +351,22 @@ builder.Services.AddServerSideBlazor(options =>
340351

341352
### Blazor WebAssembly registration
342353

343-
Take the following steps to register a root component as a custom element in a Blazor WebAssembly app.
344-
345-
Add the <xref:Microsoft.AspNetCore.Components.Web?displayProperty=fullName> namespace to the top of the `Program` file:
346-
347-
```csharp
348-
using Microsoft.AspNetCore.Components.Web;
349-
```
354+
Register a root component as a custom element in a Blazor WebAssembly app. In the following example, the code:
350355

351-
Add a namespace for the app's components. In the following example, the app's namespace is `BlazorSample` and the components are located in the `Pages` folder:
356+
* Adds a namespace for the app's components. In the example, the app's namespace is `BlazorSample`, and the components are located in the `Pages` folder.
357+
* Provides access to the API in the <xref:Microsoft.AspNetCore.Components.Web?displayProperty=fullName> namespace.
358+
* Calls <xref:Microsoft.AspNetCore.Components.Web.CustomElementsJSComponentConfigurationExtensions.RegisterCustomElement%2A> on <xref:Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder.RootComponents> to register the `Counter` component with the custom HTML element `my-counter`.
352359

353360
```csharp
354361
using BlazorSample.Pages;
355-
```
362+
using Microsoft.AspNetCore.Components.Web;
363+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
356364

357-
Call <xref:Microsoft.AspNetCore.Components.Web.CustomElementsJSComponentConfigurationExtensions.RegisterCustomElement%2A> on <xref:Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder.RootComponents>. The following example registers the `Counter` component with the custom HTML element `my-counter`:
365+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
358366

359-
```csharp
360367
builder.RootComponents.RegisterCustomElement<Counter>("my-counter");
368+
369+
await builder.Build().RunAsync();
361370
```
362371

363372
### Use the registered custom element
@@ -475,3 +484,7 @@ Generate JavaScript (JS) components from Razor components for JavaScript technol
475484

476485
> [!WARNING]
477486
> The Angular and React component features are currently **experimental, unsupported, and subject to change or be removed at any time**. We welcome your feedback on how well this particular approach meets your requirements.
487+
488+
## Additional resources
489+
490+
<xref:blazor/host-and-deploy/index>

aspnetcore/fundamentals/servers/kestrel.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ description: Learn about Kestrel, the cross-platform web server for ASP.NET Core
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: tdykstra
77
ms.custom: mvc
8-
ms.date: 08/25/2025
8+
ms.date: 12/04/2025
99
uid: fundamentals/servers/kestrel
1010
---
1111
# Kestrel web server in ASP.NET Core
1212

13-
[!INCLUDE[](~/includes/not-latest-version.md)]
13+
[!INCLUDE[](~/includes/not-latest-version-without-not-supported-content.md)]
1414

1515
By [Tom Dykstra](https://github.com/tdykstra), [Chris Ross](https://github.com/Tratcher), and [Stephen Halter](https://twitter.com/halter73)
1616

@@ -33,7 +33,7 @@ Kestrel's features include:
3333
* Building a reverse proxy with [YARP](https://github.com/microsoft/reverse-proxy).
3434
* **Extensibility:** Customize Kestrel through configuration, middleware, and custom transports.
3535
* **Performance diagnostics:** Kestrel provides built-in performance diagnostics features, such as logging and metrics.
36-
* **Memory management:** Kestrel includes features for efficient memory management, such as automatic eviction from memory pool.
36+
* **Memory management:** Kestrel includes features for efficient memory management. For more information, see <xref:fundamentals/servers/kestrel/memory-management>.
3737

3838
## Get started
3939

@@ -43,13 +43,6 @@ ASP.NET Core project templates use Kestrel by default when not hosted with IIS.
4343

4444
For more information on configuring `WebApplication` and `WebApplicationBuilder`, see <xref:fundamentals/minimal-apis>.
4545

46-
## Optional client certificates
47-
48-
For information on apps that must protect a subset of the app with a certificate, see [Optional client certificates](xref:security/authentication/certauth#optional-client-certificates).
49-
50-
51-
[!INCLUDE[](includes/memory-eviction2.md)]
52-
5346
## Additional resources
5447

5548
<a name="endpoint-configuration"></a>

aspnetcore/fundamentals/servers/kestrel/includes/kestrel6.md

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,64 @@
1-
:::moniker range=">= aspnetcore-6.0 <=aspnetcore-9.0"
1+
:::moniker range=">= aspnetcore-8.0 <= aspnetcore-9.0"
2+
3+
Kestrel is a cross-platform [web server for ASP.NET Core](xref:fundamentals/servers/index). Kestrel is the recommended server for ASP.NET Core, and it's configured by default in ASP.NET Core project templates.
4+
5+
Kestrel's features include:
6+
7+
* **Cross-platform:** Kestrel is a cross-platform web server that runs on Windows, Linux, and macOS.
8+
* **High performance:** Kestrel is optimized to handle a large number of concurrent connections efficiently.
9+
* **Lightweight:** Optimized for running in resource-constrained environments, such as containers and edge devices.
10+
* **Security hardened:** Kestrel supports HTTPS and is hardened against web server vulnerabilities.
11+
* **Wide protocol support:** Kestrel supports common web protocols, including:
12+
* HTTP/1.1, [HTTP/2](xref:fundamentals/servers/kestrel/http2) and [HTTP/3](xref:fundamentals/servers/kestrel/http3)
13+
* [WebSockets](xref:fundamentals/websockets)
14+
* **Integration with ASP.NET Core:** Seamless integration with other ASP.NET Core components, such as the middleware pipeline, dependency injection, and configuration system.
15+
* **Flexible workloads**: Kestrel supports many workloads:
16+
* ASP.NET app frameworks such as Minimal APIs, MVC, Razor pages, SignalR, Blazor, and gRPC.
17+
* Building a reverse proxy with [YARP](https://github.com/microsoft/reverse-proxy).
18+
* **Extensibility:** Customize Kestrel through configuration, middleware, and custom transports.
19+
* **Performance diagnostics:** Kestrel provides built-in performance diagnostics features, such as logging and metrics.
20+
21+
## Get started
22+
23+
ASP.NET Core project templates use Kestrel by default when not hosted with IIS. In the following template-generated `Program.cs`, the <xref:Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder%2A?displayProperty=nameWithType> method calls <xref:Microsoft.AspNetCore.Hosting.WebHostBuilderKestrelExtensions.UseKestrel%2A> internally:
24+
25+
:::code language="csharp" source="~/fundamentals/servers/kestrel/samples/6.x/KestrelSample/Program.cs" id="snippet_CreateBuilder" highlight="1":::
26+
27+
For more information on configuring `WebApplication` and `WebApplicationBuilder`, see <xref:fundamentals/minimal-apis>.
28+
29+
## Behavior with debugger attached
30+
31+
The following timeouts and rate limits aren't enforced when a debugger is attached to a Kestrel process:
32+
33+
* <xref:Microsoft.AspNetCore.Server.Kestrel.KestrelServerLimits.KeepAliveTimeout?displayProperty=nameWithType>
34+
* <xref:Microsoft.AspNetCore.Server.Kestrel.KestrelServerLimits.RequestHeadersTimeout?displayProperty=nameWithType>
35+
* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerLimits.MinRequestBodyDataRate?displayProperty=nameWithType>
36+
* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerLimits.MinResponseDataRate?displayProperty=nameWithType>
37+
* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.Features.IConnectionTimeoutFeature>
38+
* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.Features.IHttpMinRequestBodyDataRateFeature>
39+
* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.Features.IHttpMinResponseDataRateFeature>
40+
41+
## Additional resources
42+
43+
<a name="endpoint-configuration"></a>
44+
* <xref:fundamentals/servers/kestrel/endpoints>
45+
<a name="kestrel-options"></a>
46+
* <xref:fundamentals/servers/kestrel/options>
47+
<a name="http2-support"></a>
48+
* <xref:fundamentals/servers/kestrel/http2>
49+
<a name="when-to-use-kestrel-with-a-reverse-proxy"></a>
50+
* <xref:fundamentals/servers/kestrel/when-to-use-a-reverse-proxy>
51+
<a name="host-filtering"></a>
52+
* <xref:fundamentals/servers/kestrel/host-filtering>
53+
* <xref:test/troubleshoot>
54+
* <xref:security/enforcing-ssl>
55+
* <xref:host-and-deploy/proxy-load-balancer>
56+
* [RFC 9110: HTTP Semantics (Section 7.2: Host and :authority)](https://www.rfc-editor.org/rfc/rfc9110#field.host)
57+
* When using UNIX sockets on Linux, the socket isn't automatically deleted on app shutdown. For more information, see [this GitHub issue](https://github.com/dotnet/aspnetcore/issues/14134).
58+
59+
:::moniker-end
60+
61+
:::moniker range=">= aspnetcore-6.0 < aspnetcore-8.0"
262

363
Kestrel is a cross-platform [web server for ASP.NET Core](xref:fundamentals/servers/index). Kestrel is the web server that's included and enabled by default in ASP.NET Core project templates.
464

@@ -21,10 +81,6 @@ ASP.NET Core project templates use Kestrel by default when not hosted with IIS.
2181

2282
For more information on configuring `WebApplication` and `WebApplicationBuilder`, see <xref:fundamentals/minimal-apis>.
2383

24-
## Optional client certificates
25-
26-
For information on apps that must protect a subset of the app with a certificate, see [Optional client certificates](xref:security/authentication/certauth#optional-client-certificates).
27-
2884
## Behavior with debugger attached
2985

3086
The following timeouts and rate limits aren't enforced when a debugger is attached to a Kestrel process:
@@ -82,10 +138,6 @@ ASP.NET Core project templates use Kestrel by default when not hosted with IIS.
82138

83139
For more information on building the host, see the *Set up a host* and *Default builder settings* sections of <xref:fundamentals/host/generic-host#set-up-a-host>.
84140

85-
## Optional client certificates
86-
87-
For information on apps that must protect a subset of the app with a certificate, see [Optional client certificates](xref:security/authentication/certauth#optional-client-certificates).
88-
89141
## Additional resources
90142

91143
<a name="endpoint-configuration"></a>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Memory management in Kestrel
3+
author: tdykstra
4+
description: Learn about memory management in Kestrel, including automatic eviction from memory pools and using memory pool metrics.
5+
monikerRange: '>= aspnetcore-10.0'
6+
ms.author: tdykstra
7+
ms.date: 12/04/2025
8+
uid: fundamentals/servers/kestrel/memory-management
9+
---
10+
11+
# Memory management in Kestrel
12+
13+
By [Tom Dykstra](https://github.com/tdykstra)
14+
15+
This article provides guidance for managing memory in Kestrel, including automatic eviction from memory pools and using memory pool metrics.
16+
17+
## Automatic eviction from memory pool
18+
19+
The memory pools used by Kestrel, IIS, and HTTP.sys automatically evict memory blocks when the application is idle or under low load. The feature runs automatically and doesn't need to be enabled or configured manually.
20+
21+
This automatic eviction feature reduces overall memory usage and helps applications stay responsive under varying workloads. In versions of .NET earlier than 10, memory allocated by the pool remained reserved even when not in use.
22+
23+
### Use memory pool metrics
24+
25+
The default memory pool used by the ASP.NET Core server implementations includes metrics, which can be used to monitor and analyze memory usage patterns. The metrics are under the name `"Microsoft.AspNetCore.MemoryPool"`.
26+
27+
For information about metrics and how to use them, see <xref:log-mon/metrics/metrics>.
28+
29+
## Manage memory pools
30+
31+
Besides using memory pools efficiently by evicting unneeded memory blocks, ASP.NET Core provides a built-in [IMemoryPoolFactory](https://source.dot.net/#Microsoft.AspNetCore.Connections.Abstractions/IMemoryPoolFactory.cs) interface and its default implementation, which are available through dependency injection.
32+
33+
The following code example shows a simple background service that uses the built-in memory pool factory implementation to create memory pools. These pools benefit from the automatic eviction feature:
34+
35+
:::code language="csharp" source="~/fundamentals/servers/snippets/10.x/my-background-service.cs":::
36+
37+
To use a custom memory pool factory, make a class that implements `IMemoryPoolFactory` and register it with dependency injection, as the following example does. Memory pools created this way also benefit from the automatic eviction feature:
38+
39+
:::code language="csharp" source="~/fundamentals/servers/snippets/10.x/memory-pool-factory.cs":::
40+
41+
When you're using a memory pool, be aware of the pool's <xref:System.Buffers.MemoryPool`1.MaxBufferSize>.

aspnetcore/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,9 @@ items:
11901190
- name: Diagnostics
11911191
displayName: diagnostics
11921192
uid: fundamentals/servers/kestrel/diagnostics
1193+
- name: Memory management
1194+
displayName: memory, pool, kestrel
1195+
uid: fundamentals/servers/kestrel/memory-management
11931196
- name: HTTP/2
11941197
displayName: deploy, publish, server, Kestrel
11951198
uid: fundamentals/servers/kestrel/http2

0 commit comments

Comments
 (0)