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/components/js-spa-frameworks.md
+30-17Lines changed: 30 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,16 +20,27 @@ This article covers how to render Razor components from JavaScript, use Blazor c
20
20
<!-- UPDATE 11.0 - The `blazor.web.js` (Blazor Web App) portions of
21
21
this article have been commented out for the time being to
22
22
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. -->
26
24
27
25
## Angular sample apps
28
26
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:
30
28
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>.
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
-
usingMicrosoft.AspNetCore.Components.Web;
349
-
```
354
+
Register a root component as a custom element in a Blazor WebAssembly app. In the following example, the code:
350
355
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`.
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`:
@@ -475,3 +484,7 @@ Generate JavaScript (JS) components from Razor components for JavaScript technol
475
484
476
485
> [!WARNING]
477
486
> 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.
By [Tom Dykstra](https://github.com/tdykstra), [Chris Ross](https://github.com/Tratcher), and [Stephen Halter](https://twitter.com/halter73)
16
16
@@ -33,7 +33,7 @@ Kestrel's features include:
33
33
* Building a reverse proxy with [YARP](https://github.com/microsoft/reverse-proxy).
34
34
***Extensibility:** Customize Kestrel through configuration, middleware, and custom transports.
35
35
***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>.
37
37
38
38
## Get started
39
39
@@ -43,13 +43,6 @@ ASP.NET Core project templates use Kestrel by default when not hosted with IIS.
43
43
44
44
For more information on configuring `WebApplication` and `WebApplicationBuilder`, see <xref:fundamentals/minimal-apis>.
45
45
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).
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:
*[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).
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.
4
64
@@ -21,10 +81,6 @@ ASP.NET Core project templates use Kestrel by default when not hosted with IIS.
21
81
22
82
For more information on configuring `WebApplication` and `WebApplicationBuilder`, see <xref:fundamentals/minimal-apis>.
23
83
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
-
28
84
## Behavior with debugger attached
29
85
30
86
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.
82
138
83
139
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>.
84
140
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).
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:
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:
0 commit comments