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
+57-56Lines changed: 57 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Get started with the Azure WebJobs SDK for Azure App Service to enable your web
20
20
21
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.
22
22
23
-
In this tutorial, you will learn how to:
23
+
In this tutorial, you'll learn how to:
24
24
25
25
> [!div class="checklist"]
26
26
> * Create a console app
@@ -32,15 +32,15 @@ In this tutorial, you will learn how to:
32
32
33
33
## Prerequisites
34
34
35
-
* Visual Studio 2022 with the **Azure development** workload. [Install Visual Studio 2022](/visualstudio/install/).
35
+
- Visual Studio 2022 with the **Azure development** workload. [Install Visual Studio 2022](/visualstudio/install/).
36
36
37
-
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
37
+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
38
38
39
39
## Create a console app
40
-
In this section, you start by creating a project in Visual Studio 2022. Next, you'll add tools for Azure development, code publishing, and functions that listen for triggers and call functions. Last, you'll set up console logging that disables a legacy monitoring tool and enables a console provider with default filtering.
40
+
In this section, you start by creating a project in Visual Studio 2022. Next, you add tools for Azure development, code publishing, and functions that listen for triggers and call functions. Last, you set up console logging that disables a legacy monitoring tool and enables a console provider with default filtering.
41
41
42
-
>[!NOTE]
43
-
>The procedures in this article are verified for creating a C# console app that runs on .NET 8.0.
42
+
>[!NOTE]
43
+
>The procedures in this article are verified for creating a C# console app that runs on .NET 8.0.
44
44
45
45
### Create a project
46
46
@@ -50,27 +50,27 @@ In this section, you start by creating a project in Visual Studio 2022. Next, yo
50
50
51
51
1. Under **Configure your new project**, name the project *WebJobsSDKSample*, and then select **Next**.
52
52
53
-
1. Choose your **Target framework** and select **Create**. This tutorial has been verified using .NET 6.0.
53
+
1. Choose your **Target framework** and select **Create**. This tutorial was verified using .NET 6.0.
54
54
55
55
### Install WebJobs NuGet packages
56
56
57
57
Install the latest WebJobs NuGet package. This package includes Microsoft.Azure.WebJobs (WebJobs SDK), which lets you publish your function code to WebJobs in Azure App Service.
58
58
59
59
1. Get the latest stable 4.x version of the [Microsoft.Azure.WebJobs.Extensions NuGet package](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions/).
60
60
61
-
2. In Visual Studio, go to **Tools** > **NuGet Package Manager**.
61
+
1. In Visual Studio, go to **Tools** > **NuGet Package Manager**.
62
62
63
-
3. 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**. You'll see a list of NuGet cmdlets, a link to documentation, and a `PM>` entry point.
64
64
65
-
4. In the following command, replace `<4_X_VERSION>` with the current version number you found in step 1.
65
+
1. In the following command, replace `<4_X_VERSION>` with the current version number you found in step 1.
>The sample code in this article works with package versions 4.x. Make sure you use a 4.x version because you get build errors when using package versions 5.x.
70
+
>[!NOTE]
71
+
>The sample code in this article works with package versions 4.x. Make sure you use a 4.x version because you get build errors when using package versions 5.x.
72
72
73
-
5. In the **Package Manager Console**, execute the command. The extension list appears and automatically installs.
73
+
1. In the **Package Manager Console**, execute the command. The extension list appears and automatically installs.
74
74
75
75
### Create the Host
76
76
@@ -111,23 +111,23 @@ 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 a variety of 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 third-party 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
118
-
2. In the following command, replace `<9_X_VERSION>` with the current version number you found in step 1. Each type of NuGet Package has a unique version number.
118
+
1. In the following command, replace `<9_X_VERSION>` with the current version number you found in step 1. Each type of NuGet Package has a unique version number.
3. In the **Package Manager Console**, fill in the current version number and execute the command. The extension list appears and automatically installs.
123
+
1. In the **Package Manager Console**, fill in the current version number and execute the command. The extension list appears and automatically installs.
124
124
125
-
4. Under the tab **Program.cs**, add this `using` statement:
125
+
1. Under the tab **Program.cs**, add this `using` statement:
126
126
127
127
```cs
128
128
usingMicrosoft.Extensions.Logging;
129
129
```
130
-
5. Continuing under **Program.cs**, add the [`ConfigureLogging`](/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilderextensions.configurelogging) method to [`HostBuilder`](/dotnet/api/microsoft.extensions.hosting.hostbuilder), before the `Build` command. The [`AddConsole`](/dotnet/api/microsoft.extensions.logging.consoleloggerextensions.addconsole) method adds console logging to the configuration.
130
+
1. Continuing under **Program.cs**, add the [`ConfigureLogging`](/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilderextensions.configurelogging) method to [`HostBuilder`](/dotnet/api/microsoft.extensions.hosting.hostbuilder), before the `Build` command. The [`AddConsole`](/dotnet/api/microsoft.extensions.logging.consoleloggerextensions.addconsole) method adds console logging to the configuration.
131
131
132
132
```cs
133
133
builder.ConfigureLogging((context, b) =>
@@ -166,8 +166,8 @@ Set up console logging that uses the [ASP.NET Core logging framework](/aspnet/co
166
166
167
167
Thisadditionmakesthesechanges:
168
168
169
-
*Disables [dashboardlogging](https://github.com/Azure/azure-webjobs-sdk/wiki/Queues#logs). The dashboard is a legacy monitoring tool, and dashboard logging is not recommended for high-throughput production scenarios.
-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.
>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.
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.
@@ -250,9 +250,9 @@ The `QueueTrigger` attribute tells the runtime to call this function when a new
:::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.":::
It's now time to publish your WebJobs SDK project to Azure.
335
336
336
-
## <a name="deploy-as-a-webjob"></a>Deploy to Azure
337
-
338
-
Duringdeployment, youcreateanappserviceinstancewhereyou'll run your functions. When you publish a .NET console app to App Service in Azure, it automatically runs as a WebJob. To learn more about publishing, see [Develop and deploy WebJobs using Visual Studio](webjobs-dotnet-deploy-vs.md).
337
+
## Deploy to Azure
338
+
339
+
Duringdeployment, youcreateanappserviceinstancewhereyourunyourfunctions. Whenyoupublisha .NETconsoleapptoAppServiceinAzure, itautomaticallyrunsasaWebJob. Tolearnmoreaboutpublishing, see [DevelopanddeployWebJobsusingVisualStudio](webjobs-dotnet-deploy-vs.md).
339
340
340
341
### Create Azure resources
341
342
@@ -355,10 +356,9 @@ With the web app created in Azure, it's time to publish the WebJobs project.
355
356
356
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.
:::imagetype="content"source="./media/webjobs-sdk-get-started/change-webjob-type.png"alt-text="Change WebJob type from the Visual Studio 2022 Publish window.":::
1. Ifyoudon't see the *Hello App Insights!* message, select **Refresh** periodically for several minutes. Logs don'tappearimmediately, becauseittakesawhilefortheApplicationInsightsclienttoflushthelogsitprocesses.
0 commit comments