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: articles/azure-functions/dotnet-isolated-process-guide.md
+56-3Lines changed: 56 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to use a .NET isolated process to run your C# functions i
4
4
5
5
ms.service: azure-functions
6
6
ms.topic: conceptual
7
-
ms.date: 07/06/2022
7
+
ms.date: 09/29/2022
8
8
ms.custom: template-concept
9
9
recommendations: false
10
10
#Customer intent: As a developer, I need to know how to create functions that run in an isolated process so that I can run my function code on current (not LTS) releases of .NET.
@@ -136,6 +136,59 @@ The following is an example of a middleware implementation which reads the `Http
136
136
137
137
For a more complete example of using custom middleware in your function app, see the [custom middleware reference sample](https://github.com/Azure/azure-functions-dotnet-worker/blob/main/samples/CustomMiddleware).
138
138
139
+
## Cancellation tokens
140
+
141
+
A function can accept a [CancellationToken](/dotnet/api/system.threading.cancellationtoken) parameter, which enables the operating system to notify your code when the function is about to be terminated. You can use this notification to make sure the function doesn't terminate unexpectedly in a way that leaves data in an inconsistent state.
142
+
143
+
Cancellation tokens are supported in .NET isolated functions. The following example shows how to use a cancellation token in a function:
You can compile your function app as [ReadyToRun binaries](/dotnet/core/whats-new/dotnet-core-3-0#readytorun-images). ReadyToRun is a form of ahead-of-time compilation that can improve startup performance to help reduce the impact of [cold-start](event-driven-scaling.md#cold-start) when running in a [Consumption plan](consumption-plan.md).
179
+
180
+
ReadyToRun is available in .NET 3.0 and .NET 6 (in-proc and isolated) and .NET 7 and requires [version 3.0 of the Azure Functions runtime](functions-versions.md).
181
+
182
+
To compile your project as ReadyToRun, update your project file by adding the `<PublishReadyToRun>` and `<RuntimeIdentifier>` elements. The following is the configuration for publishing to a Windows 32-bit function app.
183
+
184
+
```xml
185
+
<PropertyGroup>
186
+
<TargetFramework>net7.0</TargetFramework>
187
+
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
188
+
<PublishReadyToRun>true</PublishReadyToRun>
189
+
</PropertyGroup>
190
+
```
191
+
139
192
## Execution context
140
193
141
194
.NET isolated passes a [FunctionContext] object to your function methods. This object lets you get an [ILogger] instance to write to the logs by calling the [GetLogger] method and supplying a `categoryName` string. To learn more, see [Logging](#logging).
@@ -263,9 +316,9 @@ This section describes the current state of the functional and behavioral differ
263
316
| Middleware | Not supported |[Supported](#middleware)|
264
317
| Logging |[ILogger] passed to the function<br/>[ILogger<T>] via dependency injection |[ILogger]/[ILogger<T>] obtained from [FunctionContext] or via [dependency injection](#dependency-injection)|
<sup>1</sup> When you need to interact with a service using parameters determined at runtime, using the corresponding service SDKs directly is recommended over using imperative bindings. The SDKs are less verbose, cover more scenarios, and have advantages for error handling and debugging purposes. This recommendation applies to both models.
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-dotnet-class-library.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -217,21 +217,22 @@ If you install the Core Tools using the Windows installer (MSI) package or by us
217
217
218
218
You can compile your function app as [ReadyToRun binaries](/dotnet/core/whats-new/dotnet-core-3-0#readytorun-images). ReadyToRun is a form of ahead-of-time compilation that can improve startup performance to help reduce the impact of [cold-start](event-driven-scaling.md#cold-start) when running in a [Consumption plan](consumption-plan.md).
219
219
220
-
ReadyToRun is available in .NET 3.0 and requires [version 3.0 of the Azure Functions runtime](functions-versions.md).
220
+
ReadyToRun is available in .NET 3.0 and .NET 6 (in-proc and isolated) and .NET 7 and requires [version 3.0 of the Azure Functions runtime](functions-versions.md).
221
221
222
222
To compile your project as ReadyToRun, update your project file by adding the `<PublishReadyToRun>` and `<RuntimeIdentifier>` elements. The following is the configuration for publishing to a Windows 32-bit function app.
223
223
224
224
```xml
225
225
<PropertyGroup>
226
-
<TargetFramework>netcoreapp3.1</TargetFramework>
227
-
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
226
+
<TargetFramework>net6.0</TargetFramework>
227
+
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
228
228
<PublishReadyToRun>true</PublishReadyToRun>
229
229
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
230
230
</PropertyGroup>
231
231
```
232
232
233
233
> [!IMPORTANT]
234
-
> ReadyToRun currently doesn't support cross-compilation. You must build your app on the same platform as the deployment target. Also, pay attention to the "bitness" that is configured in your function app. For example, if your function app in Azure is Windows 64-bit, you must compile your app on Windows with `win-x64` as the [runtime identifier](/dotnet/core/rid-catalog).
234
+
> Starting in .NET 6, support for Composite ReadyToRun compilation has been added. However, In .NET 6, Composite ReadyToRun is only supported for self-contained deployment.
235
+
Composite ReadyToRun compiles a set of assemblies that must be distributed together. This has the advantage that the compiler is able to perform better optimizations and reduces the set of methods that cannot be compiled via the ReadyToRun process. However, as a tradeoff, compilation speed is significantly decreased, and the overall file size of the application is significantly increased. Check out [ReadyToRun Cross platform and architecture restrictions](/dotnet/core/deploying/ready-to-run).
235
236
236
237
You can also build your app with ReadyToRun from the command line. For more information, see the `-p:PublishReadyToRun=true` option in [`dotnet publish`](/dotnet/core/tools/dotnet-publish).
0 commit comments