So I am rather stuck on this. We have been using "Default" SignalR with our Web apps for ages and all is fine.
We now want to add an Azure Function which requires SignalR to be Serverless. I can easily get SignalR and the Azure function to play ball.
However, I can not get the Web App to talk to SignalR as it says
"Critical: Service returned handshake error: Azure SignalR Service is in serverless mode, server connection is not allowed.. Id: fe6a4f57-6293-4b6f-bdec-9040ff60aef5"
Ok so looking at other tutorials like :
https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-quickstart-dotnet-core https://softchris.github.io/pages/dotnet-signalr.html#configure-signalr
You can do it in Javascript
const connection = new signalR.HubConnectionBuilder()
.withUrl('https://*****-sb-staging-signalr.service.signalr.net/statushub')
.build();
bindConnectionMessage(connection);
However this gives me CORS issues, even though SignalR accepts all and I have in mty Startup.cs
services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder.WithOrigins("https://******-sb-staging-admin.azurewebsites.net/")
.AllowCredentials();
});
});
and
services.AddSignalR(srConfig => srConfig.EnableDetailedErrors = true).AddAzureSignalR();
services.AddCors();
How on earth do I get a Web app to talk to SignalR Serverless