From 9ddb0eb390f97c0fd229fbcb7680dfa4b3705215 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Wed, 24 May 2023 10:36:46 -1000 Subject: [PATCH] Reduced size AOT /5 (#29348) * Reduced size AOT /5 * Reduced size AOT /5 * Reduced size AOT /5 * Reduced size AOT /5 * Reduced size AOT /5 --- aspnetcore/fundamentals/native-aot.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/aspnetcore/fundamentals/native-aot.md b/aspnetcore/fundamentals/native-aot.md index da1e33ba59..00cc9441ae 100644 --- a/aspnetcore/fundamentals/native-aot.md +++ b/aspnetcore/fundamentals/native-aot.md @@ -5,7 +5,7 @@ description: Learn about ASP.NET Core support for native AOT monikerRange: '>= aspnetcore-8.0' ms.author: midenn ms.custom: mvc -ms.date: 5/5/2023 +ms.date: 5/25/2023 uid: fundamentals/native-aot --- # ASP.NET Core support for native AOT @@ -141,7 +141,7 @@ Mode LastWriteTime Length Name -a--- 30/03/2023 1:41 PM 43044864 MyFirstAotWebApi.pdb ``` -The executable is self-contained and doesn't require a .NET runtime to run. When launched it should behave the same as the app run in the development environment. Run the AOT app: +The executable is self-contained and doesn't require a .NET runtime to run. When launched, it should behave the same as the app run in the development environment. Run the AOT app: ```cli .\bin\Release\net8.0\win-x64\publish\MyFirstAotWebApi.exe @@ -232,19 +232,24 @@ The AOT version of `launchSettings.json` file is simplified and has the `iisSett : -* Is used in the tempate and shown in the preceding highlighted code. +* Is used in the template and shown in the preceding highlighted code. * Enables JSON serialization with native AOT. * Specifies the custom types that are needed to serialize. * Is used by the [JSON source generator](/dotnet/standard/serialization/system-text-json/source-generation) to produce code. -The : + + +: * Initializes the with the minimal ASP.NET Core features necessary to run an app. * Is added by the template whether or not the AOT option is used. +* By default, doesn't include support for HTTPS or HTTP/3. HTTPS and HTTP/3: + * Typically aren't required for apps run behind a TLS termination proxy. For example, when using [TLS termination and end to end TLS with Application Gateway](/azure/application-gateway/ssl-overview). + * Can be enabled by calling [builder.WebHost.UseQuic](xref:Microsoft.AspNetCore.Hosting.WebHostBuilderQuicExtensions.UseQuic%2A) or [builder.WebHost.UseKestrelHttpsConfiguration](https://source.dot.net/#Microsoft.AspNetCore.Server.Kestrel/WebHostBuilderKestrelExtensions.cs,fcec859000ccaa50) :::code language="csharp" source="~/fundamentals/aot/samples/Program.cs" highlight="4"::: -Because unused code is trimmed during publishing for native AOT, the app can't use unbounded reflection at runtime. Source generators are used to produce code to avoid the need for reflection. In some cases source generators produce code optimized for AOT even when a generator is not required. To view source code that is generated based on the code in `Program.cs` add the [`true`](/dotnet/csharp/roslyn-sdk/source-generators-overview) property to `MyFirstAotWebApi.csproj`: +Because unused code is trimmed during publishing for native AOT, the app can't use unbounded reflection at runtime. Source generators are used to produce code to avoid the need for reflection. In some cases, source generators produce code optimized for AOT even when a generator is not required. To view source code that is generated based on the code in `Program.cs` add the [`true`](/dotnet/csharp/roslyn-sdk/source-generators-overview) property to `MyFirstAotWebApi.csproj`: ```xml @@ -310,7 +315,7 @@ Not all features in ASP.NET Core are currently compatible with native AOT. The f | StaticFiles | Fully supported | | | | WebSockets | Fully supported | | | -It's important to test the app thoroughly when moving to a native AOT deployment model. The AOT deployed app should be tested to verify functionality hasn't changed fron the untrimmed and JIT-compiled app. When building the app, review and correct AOT warnings. An app that issues AOT warnings during publishing is not guaranteed to work correctly. If no AOT warnings are issued at publish time, the pubished AOT app should work the same as when run in development. +It's important to test the app thoroughly when moving to a native AOT deployment model. The AOT deployed app should be tested to verify functionality hasn't changed from the untrimmed and JIT-compiled app. When building the app, review and correct AOT warnings. An app that issues AOT warnings during publishing is ***not*** guaranteed to work correctly. If no AOT warnings are issued at publish time, the published AOT app should work the same as when run in development. For more information on AOT warnings and how to address them see [Introduction to AOT warnings](/dotnet/core/deploying/native-aot/fixing-warnings).