Skip to content

Commit 286229f

Browse files
authored
Merge pull request #206902 from grminch/gm-signalr-gh02
Gm signalr gh02
2 parents fbbafa7 + dac2c3f commit 286229f

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

articles/azure-signalr/signalr-quickstart-dotnet-core.md

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@ author: vicancy
55
ms.service: signalr
66
ms.devlang: csharp
77
ms.topic: quickstart
8-
ms.custom: devx-track-csharp, mode-other
9-
ms.date: 09/28/2020
8+
ms.date: 08/03/2022
109
ms.author: lianwei
1110
---
1211

1312
# Quickstart: Create a chat room by using SignalR Service
1413

15-
Azure SignalR Service is an Azure service that helps developers easily build web applications with real-time features. This service was originally based on [SignalR for ASP.NET Core 2.1](/aspnet/core/signalr/introduction?preserve-view=true&view=aspnetcore-2.1), but now supports later versions.
14+
Azure SignalR Service is an Azure service that helps developers easily build web applications with real-time features.
1615

17-
This article shows you how to get started with the Azure SignalR Service. In this quickstart, you'll create a chat application by using an ASP.NET Core MVC web app. This app will make a connection with your Azure SignalR Service resource to enable real-time content updates. You'll host the web application locally and connect with multiple browser clients. Each client will be able to push content updates to all other clients.
16+
This article shows you how to get started with the Azure SignalR Service. In this quickstart, you'll create a chat application by using an ASP.NET Core MVC web app. This app will make a connection with your Azure SignalR Service resource to enable real-time content updates. You'll host the web application locally and connect with multiple browser clients. Each client will be able to push content updates to all other clients.
1817

1918
You can use any code editor to complete the steps in this quickstart. One option is [Visual Studio Code](https://code.visualstudio.com/), which is available on the Windows, macOS, and Linux platforms.
2019

21-
The code for this tutorial is available for download in the [AzureSignalR-samples GitHub repository](https://github.com/aspnet/AzureSignalR-samples/tree/master/samples/ChatRoom). Also, you can create the Azure resources used in this quickstart by following [Create a SignalR Service script](scripts/signalr-cli-create-service.md).
20+
The code for this tutorial is available for download in the [AzureSignalR-samples GitHub repository](https://github.com/aspnet/AzureSignalR-samples/tree/master/samples/ChatRoom). You can create the Azure resources used in this quickstart by following [Create a SignalR Service script](scripts/signalr-cli-create-service.md).
2221

2322
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note-dotnet.md)]
2423

@@ -39,9 +38,7 @@ Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.
3938

4039
## Create an Azure SignalR resource
4140

42-
[!INCLUDE [azure-signalr-create](../../includes/signalr-create.md)]
43-
44-
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know](https://aka.ms/asrs/qsnetcore).
41+
[!INCLUDE [azure-signalr-create](./includes/signalr-quickstart-create-instance.md)]
4542

4643
## Create an ASP.NET Core web app
4744

@@ -55,13 +52,11 @@ In this section, you use the [.NET Core command-line interface (CLI)](/dotnet/co
5552
dotnet new mvc
5653
```
5754
58-
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know](https://aka.ms/asrs/qsnetcore).
59-
6055
## Add Secret Manager to the project
6156
6257
In this section, you'll add the [Secret Manager tool](/aspnet/core/security/app-secrets) to your project. The Secret Manager tool stores sensitive data for development work outside your project tree. This approach helps prevent the accidental sharing of app secrets in source code.
6358
64-
1. Open your *.csproj* file. Add a `DotNetCliToolReference` element to include *Microsoft.Extensions.SecretManager.Tools*. Also add a `UserSecretsId` element as shown in the following code for *chattest.csproj*, and save the file.
59+
1. Open your *csproj* file. Add a `DotNetCliToolReference` element to include *Microsoft.Extensions.SecretManager.Tools*. Also add a `UserSecretsId` element as shown in the following code for *chattest.csproj*, and save the file.
6560
6661
```xml
6762
<Project Sdk="Microsoft.NET.Sdk.Web">
@@ -79,8 +74,6 @@ In this section, you'll add the [Secret Manager tool](/aspnet/core/security/app-
7974
</Project>
8075
```
8176
82-
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know](https://aka.ms/asrs/qsnetcore).
83-
8477
## Add Azure SignalR to the web app
8578
8679
1. Add a reference to the `Microsoft.Azure.SignalR` NuGet package by running the following command:
@@ -95,11 +88,11 @@ Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.
9588
dotnet restore
9689
```
9790
98-
3. Add a secret named *Azure:SignalR:ConnectionString* to Secret Manager.
91+
3. Add a secret named *Azure:SignalR:ConnectionString* to Secret Manager.
9992
10093
This secret will contain the connection string to access your SignalR Service resource. *Azure:SignalR:ConnectionString* is the default configuration key that SignalR looks for to establish a connection. Replace the value in the following command with the connection string for your SignalR Service resource.
10194
102-
You must run this command in the same directory as the *.csproj* file.
95+
You must run this command in the same directory as the `csproj` file.
10396
10497
```dotnetcli
10598
dotnet user-secrets set Azure:SignalR:ConnectionString "<Your connection string>"
@@ -120,7 +113,7 @@ Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.
120113
}
121114
```
122115
123-
By not passing a parameter to `AddAzureSignalR()`, this code uses the default configuration key for the SignalR Service resource connection string. The default configuration key is *Azure:SignalR:ConnectionString*.
116+
Not passing a parameter to `AddAzureSignalR()` causes this code to use the default configuration key for the SignalR Service resource connection string. The default configuration key is *Azure:SignalR:ConnectionString*.
124117
125118
5. In *Startup.cs*, update the `Configure` method by replacing it with the following code.
126119
@@ -138,7 +131,7 @@ Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.
138131
139132
### Add a hub class
140133
141-
In SignalR, a hub is a core component that exposes a set of methods that can be called from the client. In this section, you define a hub class with two methods:
134+
In SignalR, a *hub* is a core component that exposes a set of methods that can be called by the client. In this section, you define a hub class with two methods:
142135
143136
* `Broadcast`: This method broadcasts a message to all clients.
144137
* `Echo`: This method sends a message back to the caller.
@@ -175,9 +168,7 @@ The client user interface for this chat room app will consist of HTML and JavaSc
175168
176169
Copy the *css/site.css* file from the *wwwroot* folder of the [samples repository](https://github.com/aspnet/AzureSignalR-samples/tree/master/samples/ChatRoom/wwwroot). Replace your project's *css/site.css* with the one you copied.
177170
178-
Here's the main code of *index.html*:
179-
180-
Create a new file in the *wwwroot* directory named *index.html*, copy, and paste the following HTML into the newly created file:
171+
Create a new file in the *wwwroot* directory named *index.html*, copy, and paste the following HTML into the newly created file.
181172
182173
```html
183174
<!DOCTYPE html>
@@ -350,7 +341,6 @@ In this section, you'll add a development runtime environment for ASP.NET Core.
350341
}
351342
```
352343

353-
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know](https://aka.ms/asrs/qsnetcore).
354344

355345
## Build and run the app locally
356346

@@ -385,7 +375,6 @@ Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.
385375

386376
![Example of an Azure SignalR group chat](media/signalr-quickstart-dotnet-core/signalr-quickstart-complete-local.png)
387377

388-
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know](https://aka.ms/asrs/qsnetcore).
389378

390379
## Clean up resources
391380

@@ -394,7 +383,7 @@ If you'll continue to the next tutorial, you can keep the resources created in t
394383
If you're finished with the quickstart sample application, you can delete the Azure resources created in this quickstart to avoid charges.
395384

396385
> [!IMPORTANT]
397-
> Deleting a resource group is irreversible and includes all the resources in that group. Make sure that you don't accidentally delete the wrong resource group or resources. If you created the resources for hosting this sample in an existing resource group that contains resources you want to keep, you can delete each resource individually from its blade instead of deleting the resource group.
386+
> Deleting a resource group is irreversible and includes all the resources in that group. Make sure that you don't accidentally delete the wrong resource group or resources. If you created the resources this sample in an existing resource group that contains resources you want to keep, you can delete each resource individually from its blade instead of deleting the resource group.
398387

399388
Sign in to the [Azure portal](https://portal.azure.com) and select **Resource groups**.
400389

0 commit comments

Comments
 (0)