Skip to content

Commit 332e3b7

Browse files
committed
Update file
1 parent c76212f commit 332e3b7

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed
9.05 KB
Loading

includes/notification-hubs-aspnet-backend-notifyusers.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following sections discuss the creation of a new ASP.NET WebAPI backend. Thi
1818
- **Register for notifications by using the WebAPI backend**: You add a controller to handle new registrations for a client device to receive notifications. The authenticated username is automatically added to the registration as a [tag](../articles/notification-hubs/notification-hubs-tags-segment-push-message.md).
1919
- **Send notifications to clients**: You add a controller to provide a way for users to trigger a secure push to devices and clients associated with the tag.
2020

21-
Create the new ASP.NET WebAPI backend by doing the following actions:
21+
Create the new ASP.NET Core 6.0 web API backend by doing the following actions:
2222

2323
> [!IMPORTANT]
2424
> If you are using Visual Studio 2022 or earlier, before starting this tutorial, ensure that you have installed the latest version of NuGet Package Manager for Visual Studio.
@@ -34,27 +34,35 @@ Create the new ASP.NET WebAPI backend by doing the following actions:
3434

3535
2. Select **Server Explorer**, and sign in to your Azure account. To create the web site resources on your account, you must be signed in.
3636

37-
3. In Visual Studio, right-click Visual Studio solution, point to **Add**, and click **New Project**.
38-
4. Expand **Visual C#**, select **Web**, and click **ASP.NET Web Application**.
37+
3. In Visual Studio,from the File menu, select New > Project.
3938

40-
5. In the **Name** box, type **AppBackend**, and then select **OK**.
39+
4. Enter Web API in the search box.
4140

42-
![The New Project window][B1]
41+
5. Select the ASP.NET Core Web API template and select Next.
4342

44-
6. In the **New ASP.NET Project** window, select the **Web API** check box, and then select **OK**.
43+
6. In the Configure your new project dialog, name the project **AppBackend** and select **Next**.
4544

46-
![The New ASP.NET Project window][B2]
45+
7. In the **Additional information** dialog:
46+
* Confirm the **Framework** is **.NET 6.0 (Long-term support)**.
47+
* Confirm the checkbox for Use controllers(uncheck to use minimal APIs) is checked.
48+
* Uncheck **Enable OpenAPI support**.
49+
* Select **Create**.
4750

48-
7. In the **Configure Microsoft Azure Web App** window, select a subscription and then, in the **App Service plan** list, do either of the following actions:
51+
## Remove the WeatherForecast template files
52+
1. Remove the WeatherForecast.cs and Controllers/WeatherForecastController.cs example files from the new AppBackend project.
53+
2. Open Properties\launchSettings.json.
54+
3. Change launchUrl properties from weatherforcast to appbackend.
4955

50-
* Select an app service plan that you've already created.
51-
* Select **Create a new app service plan**, and then create one.
56+
In the **Configure Microsoft Azure Web App** window, select a subscription and then, in the **App Service plan** list, do either of the following actions:
57+
58+
* Select an app service plan that you've already created.
59+
* Select **Create a new app service plan**, and then create one.
5260

5361
You do not need a database for this tutorial. After you have selected your app service plan, select **OK** to create the project.
5462

55-
![The Configure Microsoft Azure Web App window][B5]
63+
![The Configure Microsoft Azure Web App window][B5]
5664

57-
If you don't see this page for configure app service plan, continue with the tutorial. You can configure it while publishing the app later.
65+
If you don't see this page for configure app service plan, continue with the tutorial. You can configure it while publishing the app later.
5866

5967
## Authenticate clients to the WebAPI backend
6068

@@ -136,7 +144,7 @@ In this section, you create a new message-handler class named **AuthenticationTe
136144

137145
> [!NOTE]
138146
> Security note: The `AuthenticationTestHandler` class does not provide true authentication. It is used only to mimic basic authentication and is not secure. You must implement a secure authentication mechanism in your production applications and services.
139-
5. To register the message handler, add the following code at the end of the `Register` method in the **App_Start/WebApiConfig.cs** class:
147+
5. To register the message handler, add the following code at the end of the `Register` method in the **Program.cs** class:
140148

141149
```csharp
142150
config.MessageHandlers.Add(new AuthenticationTestHandler());
@@ -185,9 +193,7 @@ In this section, you add a new controller to the WebAPI backend to handle reques
185193

186194
7. Next, create a new controller named **RegisterController**. In Solution Explorer, right-click the **Controllers** folder, select **Add**, and then select **Controller**.
187195

188-
8. Select **Web API 2 Controller - Empty**, and then select **Add**.
189-
190-
![The Add Scaffold window][B7]
196+
8. Select **API Controller - Empty**, and then select **Add**.
191197

192198
9. In the **Controller name** box, type **RegisterController** to name the new class, and then select **Add**.
193199

0 commit comments

Comments
 (0)