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
1. Next, replace `Program.cs` to the following code to write the current time to the console:
36
+
1. Next, replace `Program.cs` to the following code that writes the current time to the console:
37
37
38
38
```dotnet
39
39
using System;
@@ -60,12 +60,13 @@ You should see output similar to the following:
60
60
Current time with is: 07:53:07 PM -05:00
61
61
```
62
62
63
-
1. Once you've confirmed the app works, build it with the following command:
63
+
1. Once you've confirmed the app works, build it and navigate to the parent directory:
64
64
65
65
```bash
66
66
dotnet build --self-contained
67
-
```
68
67
68
+
cd ..
69
+
```
69
70
70
71
1. Next we to create `run.sh` with the following code:
71
72
@@ -174,7 +175,7 @@ WebJobs is a feature of Azure App Service that enables you to run a program
174
175
## Prerequisites
175
176
176
177
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
177
-
- An existing App Service [Node app](quickstart-node.md).
178
+
- An existing App Service [Node app](quickstart-nodejs.md).
178
179
-**[Always on](configure-common.md?tabs=portal#configure-general-settings)** must be enabled on your app.
179
180
- Ensure the App setting `WEBSITE_SKIP_RUNNING_KUDUAGENT` is set to `false`.
180
181
@@ -240,7 +241,64 @@ WebJobs is a feature of Azure App Service that enables you to run a program
240
241
-**[Always on](configure-common.md?tabs=portal#configure-general-settings)** must be enabled on your app.
241
242
- Ensure the App setting `WEBSITE_SKIP_RUNNING_KUDUAGENT` is set to `false`.
242
243
243
-
## Download the sample WebJob
244
+
## Create your sample WebJob
245
+
246
+
1. In this step, you create a basic .NET WebJob project and navigate to the project root.
247
+
248
+
```bash
249
+
dotnet new console -n webjob –framework net9.0
250
+
251
+
cd webjob
252
+
```
253
+
254
+
1. Next, replace `Program.cs` to the following code that writes the current time to the console:
255
+
256
+
```dotnet
257
+
using System;
258
+
259
+
class Program
260
+
{
261
+
static void Main()
262
+
{
263
+
DateTimeOffset now = DateTimeOffset.Now;
264
+
Console.WriteLine("Current time with is: " + now.ToString("hh:mm:ss tt zzz"));
265
+
}
266
+
}
267
+
```
268
+
269
+
1. From the *webjob* directory, run the webjob to confirm the current time is output to the console:
270
+
271
+
```bash
272
+
dotnet run
273
+
```
274
+
275
+
You should see output similar to the following:
276
+
277
+
```bash
278
+
Current time with is: 07:53:07 PM -05:00
279
+
```
280
+
281
+
1. Once you've confirmed the app works, build it and navigate to the parent directory:
282
+
283
+
```bash
284
+
dotnet build --self-contained
285
+
286
+
cd ..
287
+
```
288
+
289
+
1. Next we to create `run.sh` with the following code:
290
+
291
+
```text
292
+
#!/bin/bash
293
+
294
+
dotnet webjob/bin/Debug/net9.0/webjob.dll
295
+
```
296
+
297
+
1. Now package all the files into a .zip as shown below:
0 commit comments