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
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,16 +48,17 @@ This article shows you how to deploy WebJobs as a .NET Core console app. To depl
48
48
49
49
The host is the runtime container for functions that listens for triggers and calls functions. The following steps create a host that implements [`IHost`](/dotnet/api/microsoft.extensions.hosting.ihost), which is the Generic Host in ASP.NET Core.
50
50
51
-
1. In *Program.cs*, add a `using` statement:
51
+
1. In *Program.cs*, add these `using` statements:
52
52
53
53
```cs
54
+
using System.Threading.Tasks;
54
55
using Microsoft.Extensions.Hosting;
55
56
```
56
57
57
58
1. Replace the `Main` method with the following code:
58
59
59
60
```cs
60
-
static void Main(string[] args)
61
+
static async Task Main()
61
62
{
62
63
var builder = new HostBuilder();
63
64
builder.ConfigureWebJobs(b =>
@@ -67,7 +68,7 @@ The host is the runtime container for functions that listens for triggers and ca
67
68
var host = builder.Build();
68
69
using (host)
69
70
{
70
-
host.Run();
71
+
await host.RunAsync();
71
72
}
72
73
}
73
74
```
@@ -106,7 +107,7 @@ In this section, you set up console logging that uses the [ASP.NET Core logging
106
107
The `Main` methodnowlookslikethis:
107
108
108
109
```cs
109
-
staticvoidMain(string[] args)
110
+
staticasyncTaskMain()
110
111
{
111
112
varbuilder=newHostBuilder();
112
113
builder.ConfigureWebJobs(b=>
@@ -120,7 +121,7 @@ In this section, you set up console logging that uses the [ASP.NET Core logging
120
121
varhost=builder.Build();
121
122
using (host)
122
123
{
123
-
host.Run();
124
+
awaithost.RunAsync();
124
125
}
125
126
}
126
127
```
@@ -369,7 +370,7 @@ To take advantage of [Application Insights](../azure-monitor/app/app-insights-ov
0 commit comments