I have set up an Azure SignalR service (ASRS) very similarly to how it is explained here: https://github.com/aspnet/AzureSignalR-samples. The solution is using .Net Framework 4.8 with ASP.NET MVC. When not using ASRS, it sets up the connection in the Startup class Configuration like this:
app.MapSignalR();
and that works. However, when I use app.MapAzureSignalR(...)
the client cannot retrieve historical messages using the GetChats method in this hub:
public class GroupChatService : Hub
{
public Task JoinChat(string chatId)
{
return Groups.Add(Context.ConnectionId, chatId);
}
public object GetChats(string chatId, string date)
{
/* Code removed for brevity */
var chats = model.GetPage(Guid.Parse(chatId), date.ToDate());
return new { loadMore = model.LoadMore, messages = chats };
}
And this client code:
chatService = $.connection.groupChatService;
$.connection.hub.start().done(function () {
chatService.server.joinChat(chatId);
chatService.server.getChats(chatId, date).then(function (results) {
//show the results
}
});
The resulting error looks like this:
How do I get this to work?
It turned out that the MapAzureSignalR
call needed a more specific application name in my multi-tenant environment so that it could route properly.