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
In this article, you use command-line tools to create a C# function that responds to HTTP requests. After testing the code locally, you deploy it to the serverless environment of Azure Functions.
17
17
18
+
This article supports creating both types of compiled C# functions:
This article creates an HTTP triggered function that runs on .NET 6.0. There is also a [Visual Studio Code-based version](create-first-function-vs-code-csharp.md) of this article.
| Application Insights dependencies |[Supported](functions-monitoring.md#dependencies)| Not Supported |
272
272
273
+
274
+
## Remote Debugging using Visual Studio
275
+
276
+
Because your isolated process app runs outside the Functions runtime, you need to attach the remote debugger to a separate process. To learn more about debugging using Visual Studio, see [Remote Debugging](functions-develop-vs.md?tabs=isolated-process#remote-debugging).
273
277
## Next steps
274
278
275
279
+[Learn more about triggers and bindings](functions-triggers-bindings.md)
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-develop-vs.md
+80-4Lines changed: 80 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Unless otherwise noted, procedures and examples shown are for Visual Studio 2022
25
25
26
26
## Prerequisites
27
27
28
-
- Azure Functions Tools. To add Azure Function Tools, include the **Azure development** workload in your Visual Studio installation. If you are using Visual Studio 2017, you may need to [follow some additional installation steps](#azure-functions-tools-with-visual-studio-2017).
28
+
- Azure Functions Tools. To add Azure Function Tools, include the **Azure development** workload in your Visual Studio installation. If you're using Visual Studio 2017, you may need to [follow some extra installation steps](#azure-functions-tools-with-visual-studio-2017).
29
29
30
30
- Other resources that you need, such as an Azure Storage account, are created in your subscription during the publishing process.
31
31
@@ -78,7 +78,7 @@ In C# class library functions, the bindings used by the function are defined by
78
78
79
79

80
80
81
-
You will then be prompted to choose between two Azure storage emulators or referencing a provisioned Azure storage account.
81
+
You'll then be prompted to choose between two Azure storage emulators or referencing a provisioned Azure storage account.
82
82
83
83
This trigger example uses a connection string with a key named `QueueStorage`. This key, stored in the [local.settings.json file](functions-develop-local.md#local-settings-file), either references the Azure storage emulators or an Azure storage account.
84
84
@@ -134,7 +134,7 @@ As with triggers, input and output bindings are added to your function as bindin
134
134
135
135
---
136
136
137
-
Inthisexamplereplace `<BINDING_TYPE>` withthenamespecifictothebindingextensionand `<TARGET_VERSION>` withaspecificversionofthepackage, suchas `3.0.0-beta5`. Validversionsarelistedontheindividualpackagepagesat [NuGet.org](https://nuget.org). The major versions that correspond to Functions runtime 1.x or 2.x are specified in the reference article for the binding.
137
+
Inthisexample,replace `<BINDING_TYPE>` withthenamespecifictothebindingextensionand `<TARGET_VERSION>` withaspecificversionofthepackage, suchas `3.0.0-beta5`. Validversionsarelistedontheindividualpackagepagesat [NuGet.org](https://nuget.org). The major versions that correspond to Functions runtime 1.x or 2.x are specified in the reference article for the binding.
@@ -163,7 +163,7 @@ For a full list of the bindings supported by Functions, see [Supported bindings]
163
163
164
164
## Run functions locally
165
165
166
-
AzureFunctionsCoreToolsletsyourunAzureFunctionsprojectonyourlocaldevelopmentcomputer. WhenyoupressF5todebugaFunctionsproject, thelocalFunctionshost (func.exe) startstolistenonalocalport (usually7071). Anycallablefunctionendpointsarewrittentotheoutput, andyoucanusethesefortestingyourfunctions. Formoreinformation, see [WorkwithAzureFunctionsCoreTools](functions-run-local.md). You're prompted to install these tools the first time you start a function from Visual Studio.
166
+
AzureFunctionsCoreToolsletsyourunAzureFunctionsprojectonyourlocaldevelopmentcomputer. WhenyoupressF5todebugaFunctionsproject, thelocalFunctionshost (func.exe) startstolistenonalocalport (usually7071). Anycallablefunctionendpointsarewrittentotheoutput, andyoucanusetheseendpointsfortestingyourfunctions. Formoreinformation, see [WorkwithAzureFunctionsCoreTools](functions-run-local.md). You're prompted to install these tools the first time you start a function from Visual Studio.
167
167
168
168
TostartyourfunctioninVisualStudioindebugmode:
169
169
@@ -209,6 +209,82 @@ You can also manage application settings in one of these other ways:
*Whileyou're debugging, the server is sending data to Visual Studio, which could affect bandwidth charges. For information about bandwidth rates, see [Azure Pricing](https://azure.microsoft.com/pricing/calculator/).
224
+
*Remotedebuggingisautomaticallydisabledinyourfunctionappafter 48 hours. After 48 hours, you'll need to reenable remote debugging.
:::imagetype="content"source="media/functions-develop-vs/attach-to-process-in-process.png"alt-text="Screenshot of attaching the debugger from Visual Studio.":::
239
+
240
+
VisualStudioconnectstoyourfunctionappandenablesremotedebugging, ifit's not already enabled. It also locates and attaches the debugger to the host process for the app. At this point, you can debug your function app as normal.
>The .publishsettingsfilecontainsyourcredentials (unencoded) thatareusedtoadministeryourfunctionapp. Thesecuritybestpracticeforthisfileistostoreittemporarilyoutsideyoursourcedirectories (forexampleintheLibraries\Documentsfolder), andthendeleteitafterit's no longer needed. A malicious user who gains access to the .publishsettings file can edit, create, and delete your function app.
:::imagetype="content"source="media/functions-develop-vs/attach-to-process-in-process.png"alt-text="Screenshot of attaching the debugger from Visual Studio.":::
254
+
255
+
VisualStudioconnectstoyourfunctionappandenablesremotedebugging, ifit's not already enabled.
256
+
257
+
> [!NOTE]
258
+
>Becausetheremotedebuggerisn't able to connect to the host process, you could see an error. In any case, the default debugging won'tbreakintoyourcode.
1. Fromthe**Debug**menu, select**AttachtoProcess**, andinthe**Attachtoprocess**window, pastetheURLinthe**ConnectionTarget**, remove `https://` and append the port `:4024`.
1. Check**Showprocessfromallusers**andthenchoose**dotnet.exe**andselect**Attach**. Whentheoperationcompletes, you're attached to your C# class library code running in an isolated process. At this point, you can debug your function app as normal.
275
+
276
+
---
277
+
278
+
### Disable remote debugging
279
+
280
+
Afteryou're done remote debugging your code, you should disable remote debugging in the [Azure portal](https://portal.azure.com). Remote debugging is automatically disabled after 48 hours, in case you forget.
TherecommendedwaytomonitortheexecutionofyourfunctionsisbyintegratingyourfunctionappwithAzureApplicationInsights. WhenyoucreateafunctionappintheAzureportal, thisintegrationisdoneforyoubydefault. However, whenyoucreateyourfunctionappduringVisualStudiopublishing, theintegrationinyourfunctionappinAzureisn't done. To learn how to connect Application Insights to your function app, see [Enable Application Insights integration](configure-monitoring.md#enable-application-insights-integration).
Copy file name to clipboardExpand all lines: includes/functions-dotnet-execution-model.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,6 @@ ms.date: 09/18/2021
6
6
ms.author: glenga
7
7
---
8
8
9
-
This article supports creating both types of compiled C# functions:
10
-
11
9
| Execution model | Description |
12
10
| --- | --- |
13
11
|**[In-process](../articles/azure-functions/create-first-function-cli-csharp.md?tabs=in-process)**| Your function code runs in the same process as the Functions host process. Supports both .NET Core 3.1 and .NET 6.0. To learn more, see [Develop C# class library functions using Azure Functions](../articles/azure-functions/functions-dotnet-class-library.md). |
0 commit comments