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: includes/notification-hubs-aspnet-backend-notifyusers.md
+23-21Lines changed: 23 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,11 +18,8 @@ The following sections discuss the creation of a new ASP.NET WebAPI backend. Thi
18
18
-**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).
19
19
-**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.
20
20
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:
22
22
23
-
> [!IMPORTANT]
24
-
> If you are using Visual Studio 2015 or earlier, before starting this tutorial, ensure that you have installed the latest version of NuGet Package Manager for Visual Studio.
25
-
>
26
23
>To check, start Visual Studio. On the **Tools** menu, select **Extensions and Updates**. Search for **NuGet Package Manager** in your version of Visual Studio, and make sure you have the latest version. If your version is not the latest version, uninstall it, and then reinstall the NuGet Package Manager.
27
24
28
25
![Screenshot of the Extensions and Updates dialog box with the NuGet Package manage for Visual Studios package highlighted.][B4]
@@ -34,27 +31,35 @@ Create the new ASP.NET WebAPI backend by doing the following actions:
34
31
35
32
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.
36
33
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**.
34
+
3. In Visual Studio's **File** menu, select **New** > **Project**.
39
35
40
-
5. In the **Name** box, type **AppBackend**, and then select **OK**.
36
+
4. Enter **Web API** in the search box.
41
37
42
-
![The New Project window][B1]
38
+
5. Select the **ASP.NET Core Web API** project template and select **Next**.
43
39
44
-
6. In the **New ASP.NET Project**window, select the **Web API**check box, and then select **OK**.
40
+
6. In the **Configure your new project**dialog, name the project **AppBackend** and select **Next**.
45
41
46
-
![The New ASP.NET Project window][B2]
42
+
7. In the **Additional information** dialog:
43
+
* Confirm the **Framework** is **.NET 6.0 (Long-term support)**.
44
+
* Confirm the checkbox for **Use controllers(uncheck to use minimal APIs)** is checked.
45
+
* Uncheck **Enable OpenAPI support**.
46
+
* Select **Create**.
47
47
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:
48
+
## Remove the WeatherForecast template files
49
+
1. Remove the *WeatherForecast.cs* and *Controllers/WeatherForecastController.cs* example files from the new *AppBackend* project.
50
+
2. Open *Properties\launchSettings.json*.
51
+
3. Change **launchUrl** properties from **weatherforcast** to **appbackend**.
49
52
50
-
* Select an app service plan that you've already created.
51
-
* Select **Create a new app service plan**, and then create one.
53
+
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:
54
+
55
+
* Select an Azure App Service plan that you've already created.
56
+
* Select **Create a new app service plan**, and then create one.
52
57
53
58
You do not need a database for this tutorial. After you have selected your app service plan, select **OK** to create the project.
54
59
55
-
![The Configure Microsoft Azure Web App window][B5]
60
+
![The Configure Microsoft Azure Web App window][B5]
56
61
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.
62
+
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.
58
63
59
64
## Authenticate clients to the WebAPI backend
60
65
@@ -136,7 +141,7 @@ In this section, you create a new message-handler class named **AuthenticationTe
136
141
137
142
> [!NOTE]
138
143
>Securitynote:The `AuthenticationTestHandler` classdoes 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:
144
+
5. To register the message handler, add the following code at the end of the `Register` method in the *Program.cs* file:
0 commit comments