Skip to content

Commit e19d626

Browse files
committed
java
1 parent 0647943 commit e19d626

File tree

1 file changed

+63
-5
lines changed

1 file changed

+63
-5
lines changed

articles/app-service/quickstart-webjobs.md

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dotnet new console -n webjob –framework net9.0
3333
cd webjob
3434
```
3535

36-
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:
3737

3838
```dotnet
3939
using System;
@@ -60,12 +60,13 @@ You should see output similar to the following:
6060
Current time with is: 07:53:07 PM -05:00
6161
```
6262

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:
6464

6565
```bash
6666
dotnet build --self-contained
67-
```
6867

68+
cd ..
69+
```
6970

7071
1. Next we to create `run.sh` with the following code:
7172

@@ -174,7 +175,7 @@ WebJobs is a feature of Azure App Service that enables you to run a program
174175
## Prerequisites
175176

176177
- 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).
178179
- **[Always on](configure-common.md?tabs=portal#configure-general-settings)** must be enabled on your app.
179180
- Ensure the App setting `WEBSITE_SKIP_RUNNING_KUDUAGENT` is set to `false`.
180181

@@ -240,7 +241,64 @@ WebJobs is a feature of Azure App Service that enables you to run a program
240241
- **[Always on](configure-common.md?tabs=portal#configure-general-settings)** must be enabled on your app.
241242
- Ensure the App setting `WEBSITE_SKIP_RUNNING_KUDUAGENT` is set to `false`.
242243

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:
298+
299+
```bash
300+
zip webjob.zip run.sh webjob/bin/Debug/net9.0/*
301+
```
244302
245303
:::zone-end
246304

0 commit comments

Comments
 (0)