Bind Azure Signal R Services to an existing App service hosting a Signal R server

111 Views Asked by At

I need help binding an Azure Signal R service to an existing App service, I haven't found any useful documentation about this, only guides in how to bind them on scratch but never for existing services. My Azure App service is hosting a Backend Signal R server and I need to add the Azure Signal R services to this existing App service, any sugestions?

Thanks for your time!

1

There are 1 best solutions below

0
Xinran Shen On

If you wanna add Azure signalR to your existing App service, you need to

Add a reference to the Microsoft.Azure.SignalR NuGet package by running the following command:

dotnet add package Microsoft.Azure.SignalR

Open Program.cs and update the code to the following, it calls the AddSignalR() and AddAzureSignalR() methods to use Azure SignalR Service:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR().AddAzureSignalR();
var app = builder.Build();

app.UseDefaultFiles();
app.UseRouting();
app.UseStaticFiles();
app.MapHub<ChatSampleHub>("/chat");
app.Run();

More steps please refer to this link.

Please note that don't select serverless in ServiceMode dropdown list.

enter image description here

Please refer to link