A
A
Anton Baryshev2021-12-30 22:28:56
ASP.NET
Anton Baryshev, 2021-12-30 22:28:56

Why is the SignalR hub not being added?

Hello. I am learning to write ASP.NET Core WEB API applications and I need to stream data from server to client. I read on the Internet how this can be done. It was written there that you need to use SignalR. Well, I added a class library project to my solution created before, in it I created a folder for storing SignalR hubs:
61ce02601f48e033551760.png
Then I created a hub class and inherited it from Hub:

public class RemoteLoggingHub : Hub
    {
        public async Task Log(string logMessage)
        {
            await this.Clients.All.SendAsync("Send", logMessage);
        }
    }


After that I include SignalR in Program.cs:
builder.Services.AddSignalR();
After that I try to add hub routes:
app.MapHub<RemoteLoggingHub>("/hubs/serverlogging");

But, I get the following error:
61ce080fbbfe3114768342.png

I seem to be doing everything according to the guides, but in the end it doesn’t work. I don't understand why I can't convert RemoteLoggingHub to Hub . Thank you in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question