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/app-service/webjobs-sdk-get-started.md
+36-31Lines changed: 36 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,9 @@ ms.custom:
18
18
19
19
Get started with the Azure WebJobs SDK for Azure App Service to enable your web apps to run background tasks, scheduled tasks, and respond to events.
20
20
21
-
Use Visual Studio 2022 to create a .NET 8 console app that uses the WebJobs SDK to respond to Azure Storage Queue messages, run the project locally, and finally deploy it to Azure.
21
+
In this tutorial, you use Visual Studio 2022 to create a .NET 8 console app that uses the WebJobs SDK to respond to Azure Storage Queue messages. Then, you run the project locally, and finally deploy it to Azure.
22
22
23
-
In this tutorial, you'll learn how to:
23
+
You learn how to:
24
24
25
25
> [!div class="checklist"]
26
26
> * Create a console app
@@ -60,7 +60,7 @@ Install the latest WebJobs NuGet package. This package includes Microsoft.Azure.
60
60
61
61
1. In Visual Studio, go to **Tools** > **NuGet Package Manager**.
62
62
63
-
1. Select **Package Manager Console**. You'll see a list of NuGet cmdlets, a link to documentation, and a `PM>` entry point.
63
+
1. Select **Package Manager Console**. On the console, you see a list of NuGet cmdlets, a link to documentation, and a `PM>` entry point.
64
64
65
65
1. In the following command, replace `<4_X_VERSION>` with the current version number you found in step 1.
66
66
@@ -111,7 +111,7 @@ In ASP.NET Core, host configurations are set by calling methods on the [`HostBui
111
111
112
112
### Enable console logging
113
113
114
-
Set up console logging that uses the [ASP.NET Core logging framework](/aspnet/core/fundamentals/logging). This framework, Microsoft.Extensions.Logging, includes an API that works with various built-in and third-party logging providers.
114
+
Set up console logging that uses the [ASP.NET Core logging framework](/aspnet/core/fundamentals/logging). This framework, Microsoft.Extensions.Logging, includes an API that works with various built-in and non-Microsoft logging providers.
115
115
116
116
1. Get the latest stable version of the [`Microsoft.Extensions.Logging.Console` NuGet package](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Console/), which includes `Microsoft.Extensions.Logging`.
117
117
@@ -139,7 +139,7 @@ Set up console logging that uses the [ASP.NET Core logging framework](/aspnet/co
139
139
});
140
140
```
141
141
142
-
Thisaddsloggingthatcaptureslogoutputfor function executions at the `Information` level, the host at the `Debug` level, and the `error` level for all other components. The `Main` method now looks like this:
142
+
Thismethodaddsloggingthatcaptureslogoutputfor function executions at the `Information` level, the host at the `Debug` level, and the `error` level for all other components. The `Main` method now looks like this:
143
143
144
144
```cs
145
145
static async Task Main()
@@ -169,11 +169,11 @@ Set up console logging that uses the [ASP.NET Core logging framework](/aspnet/co
169
169
-Disables [dashboardlogging](https://github.com/Azure/azure-webjobs-sdk/wiki/Queues#logs). The dashboard is a legacy monitoring tool, and dashboard logging isn't recommended for high-throughput production scenarios.
Afunctionisunitofcodethatrunsonaschedule, istriggeredbasedonevents, orisrunondemand. Atriggerlistenstoaserviceevent. InthecontextoftheWebJobsSDK, triggereddoesn't refer to the deployment mode. Event-driven or scheduled WebJobs created using the SDK should always be deployed as continuous WebJobs with "Always on" enabled.
176
+
Afunctionisaunitofcodethatrunsonaschedule, istriggeredbasedonevents, orisrunondemand. Atriggerlistenstoaserviceevent. InthecontextoftheWebJobsSDK, triggereddoesn't refer to the deployment mode. Event-driven or scheduled WebJobs created using the SDK should always be deployed as continuous WebJobs with *Always on* enabled.
>Beginningwith5.x, Microsoft.Azure.WebJobs.Extensions.Storagehasbeen[splitbystorageservice](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/CHANGELOG.md#major-changes-and-features) and has migrated the `AddAzureStorage()` extension method by service type. This version also requires you to update the version of the `Microsoft.Azure.WebJobs.Host.Storage` assembly used by the SDK.
185
+
>Beginningwith5.x, `Microsoft.Azure.WebJobs.Host.Storage` is[splitaccordingtostorageservice](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/CHANGELOG.md#major-changes-and-features), with the `AddAzureStorage()` extension method migrated per service type. This version also requires you to update the version of the `Microsoft.Azure.WebJobs.Host.Storage` assembly used by the SDK.
186
186
187
187
1. Getthelateststableversionofthe [Microsoft.Azure.WebJobs.Extensions.Storage](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage) NuGet package, version 5.x.
188
188
@@ -215,7 +215,7 @@ Starting with version 3 of the WebJobs SDK, to connect to Azure Storage services
Runningin [developmentmode](webjobs-sdk-how-to.md#host-development-settings) reducesthe [queuepollingexponentialbackoff](../azure-functions/functions-bindings-storage-queue-trigger.md?tabs=csharp#polling-algorithm)thatcansignificantlydelaytheamountoftimeittakesfortheruntimetofindthemessageandinvokethefunction. Youshouldremovethislineofcodeorswitch to `Production` when you're done with development and testing.
218
+
Runningin [developmentmode](webjobs-sdk-how-to.md#host-development-settings) reducesthe [queuepollingexponentialbackoff](../azure-functions/functions-bindings-storage-queue-trigger.md?tabs=csharp#polling-algorithm). Thispollingalgorithmcansignificantlydelaytheamountoftimeittakesfortheruntimetofindthemessageandinvokethefunction. Youshouldremovethislineofcodeorswitch to `Production` when you're done with development and testing.
219
219
220
220
The `Main` method should now look like the following example:
221
221
@@ -270,25 +270,25 @@ The `QueueTrigger` attribute tells the runtime to call this function when a new
The `message` parameterdoesn't have to be a string. You can also bind to a JSON object, a byte array, or a [CloudQueueMessage](/dotnet/api/microsoft.azure.storage.queue.cloudqueuemessage) object. [See Queue trigger usage](../azure-functions/functions-bindings-storage-queue-trigger.md?tabs=csharp#usage). Each binding type (such as queues, blobs, or tables) has a different set of parameter types that you can bind to.
276
276
277
277
### Create an Azure storage account
278
278
279
-
TheAzureStorageEmulatorthatrunslocallydoesn't have all of the features that the WebJobs SDK needs. You'llcreateastorageaccountinAzureandconfiguretheprojecttouseit.
279
+
TheAzureStorageEmulatorthatrunslocallydoesn't have all of the features that the WebJobs SDK needs. You need to create a storage account in Azure and configure the project to use it.
280
280
281
281
Tolearnhowtocreateageneral-purposev2storageaccount, see [CreateanAzureStorageaccount](../storage/common/storage-account-create.md?tabs=azure-portal).
:::imagetype="content"source="./media/webjobs-sdk-get-started/connection-key.png"alt-text="Screenshot of the Access keys dialog showing how to locate and copy the connection string.":::
292
292
293
293
### Configure storage to run locally
294
294
@@ -312,25 +312,30 @@ Because this file contains a connection string secret, you shouldn't store the f
:::imagetype="content"source="./media/webjobs-sdk-get-started/create-queue-azure-storage.png"alt-text="This image shows how to create a new Azure Storage Queue.":::
324
+
:::imagetype="content"source="./media/webjobs-sdk-get-started/create-queue-azure-storage.png"alt-text="Screenshoit that calls out the four steps for creating a new Azure Storage Queue.":::
:::imagetype="content"source="./media/webjobs-sdk-get-started/hello-world-text.png"alt-text="Screenshot of the Add message to queue dialog showing the text 'Hello World!' added as message text.":::
It's now time to publish your WebJobs SDK project to Azure.
336
341
@@ -354,15 +359,15 @@ For a continuous WebJob, you should enable the Always on setting in the site so
354
359
355
360
WiththewebappcreatedinAzure, it's time to publish the WebJobs project.
356
361
357
-
1. Inthe**Publish**pageunder**Hosting**, selecttheeditbuttonandchangethe**WebJobType**to `Continuous` andselect**Save**. ThismakessurethattheWebJobisrunning when messages are added to the queue. Triggered WebJobs are typically used only for manual webhooks.
362
+
1. Inthe**Publish**pageunder**Hosting**, selecttheeditbuttonandchangethe**WebJobType**to `Continuous` andselect**Save**. ThissettingmakessurethattheWebJobisrunning when messages are added to the queue. Triggered WebJobs are typically used only for manual webhooks.
358
363
359
-
:::imagetype="content"source="./media/webjobs-sdk-get-started/change-webjob-type.png"alt-text="Change WebJob type from the Visual Studio 2022 Publish window.":::
364
+
:::imagetype="content"source="./media/webjobs-sdk-get-started/change-webjob-type.png"alt-text="Screenshoit showing how to change the WebJob type from the Visual Studio 2022 Publish window.":::
:::imagetype="content"source="./media/webjobs-sdk-get-started/select-search.png"alt-text="Screenshot showing how to search and display Application Insights data.":::
475
480
476
481
1. Ifyoudon't see the *Hello App Insights!* message, select **Refresh** periodically for several minutes. Logs don'tappearimmediately, becauseittakesawhilefortheApplicationInsightsclienttoflushthelogsitprocesses.
477
482
478
-
:::imagetype="content"source="./media/webjobs-sdk-get-started/logs-in-ai.png"alt-text="Logs in Application Insights.":::
483
+
:::imagetype="content"source="./media/webjobs-sdk-get-started/logs-in-ai.png"alt-text="Screenshot showing how to display and refresh your logs in Application Insights.":::
Inputbindingssimplifycodethatreadsdata. Forthisexample, thequeuemessageisthenameofablob, whichyou'll use to find and read a blob in Azure Storage. You will then use output bindings to write a copy of the file to the same container.
@@ -532,7 +537,7 @@ Input bindings simplify code that reads data. For this example, the queue messag
532
537
533
538
1. Selectthe**Upload**button.
534
539
535
-
:::imagetype="content"source="./media/webjobs-sdk-get-started/blob-upload-button.png"alt-text="Screenshot of the Blob upload button.":::
540
+
:::imagetype="content"source="./media/webjobs-sdk-get-started/blob-upload-button.png"alt-text="Screenshot highlighting the Upload button on the blob container screen.":::
:::imagetype="content"source="./media/webjobs-sdk-get-started/queue-msg-program-cs.png"alt-text="Screenshot of the Add message to queue dialog showing the text 'Program.cs' added as message text.":::
0 commit comments