Skip to content

Commit 4cd11f6

Browse files
authored
Update signalr-howto-work-with-azure-front-door.md
1 parent 7b21f03 commit 4cd11f6

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

articles/azure-signalr/signalr-howto-work-with-azure-front-door.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Paste in the content to the `afd-demo.csproj` file. This project uses only the "
9393
```
9494

9595
#### Configure app settings
96-
Create an `appsettings.json` file and paste in the content. The values will be referenced in the `Program.cs` file, which we create in the next step.
96+
Create an `appsettings.json` file and paste in the content. The values will be referenced in the `Program.cs` file, which we create in the next step. Add a `ClientEndpoint` section in the ConnectionString.
9797
```bash
9898
touch appsettings.json
9999
```
@@ -104,10 +104,7 @@ touch appsettings.json
104104
{
105105
"Azure": {
106106
"SignalR": {
107-
"ConnectionString": "<the-connection-string-of-your-Azure-SignalR-resource>"
108-
},
109-
"AFD": {
110-
"Endpoint": "<the-endpoint-of-your-Azure-Front-Door-resource>"
107+
"ConnectionString": "<the-connection-string-of-your-Azure-SignalR-resource>;ClientEndpoint=<the-endpoint-of-your-Azure-Front-Door-resource>"
111108
}
112109
}
113110
}
@@ -123,21 +120,8 @@ Paste in the code to the `Program.cs` file. The web app defines a SignalR hub an
123120
using Microsoft.Azure.SignalR;
124121
var builder = WebApplication.CreateBuilder(args);
125122

126-
// Reads in the configuration from `appsettings.json`
127-
var azureSignalRConnectionString = builder.Configuration["Azure:SignalR:ConnectionString"];
128-
var afdEndpoint = builder.Configuration["Azure:AFD:Endpoint"];
129-
130-
builder.Services.AddSignalR().AddAzureSignalR(o =>
131-
{
132-
o.Endpoints = new Microsoft.Azure.SignalR.ServiceEndpoint[1]
133-
{
134-
new Microsoft.Azure.SignalR.ServiceEndpoint(azureSignalRConnectionString)
135-
{
136-
// Instructs SignalR server to return a `ClientEndpoint` to SignalR clients, with which they establish a connection. In our case, it's the endpoint of the Azure Front Door resource you just created.
137-
ClientEndpoint = new Uri(afdEndpoint),
138-
}
139-
};
140-
});
123+
// Automatically read in the configuration from `appsettings.json`
124+
builder.Services.AddSignalR().AddAzureSignalR();
141125

142126
var app = builder.Build();
143127
app.UseStaticFiles();

0 commit comments

Comments
 (0)