5

I add SignalR to ASP .Net Core 2 app

packages

  • "Microsoft.AspNetCore.All" Version="2.0.0"
  • "Microsoft.AspNetCore.SignalR" Version="1.0.0-alpha2-27025"
  • "Microsoft.AspNetCore.SignalR.Client" Version="1.0.0-alpha2-27025"
  • "Microsoft.AspNetCore.SignalR.Client.Core" Version="1.0.0-alpha2-27025"
  • "Microsoft.AspNetCore.SignalR.Common" Version="1.0.0-alpha2-27025"
  • "Microsoft.AspNetCore.SignalR.Core" Version="1.0.0-alpha2-27025"
public IServiceProvider ConfigureServices(IServiceCollection services)
{
    services.AddSignalRCore();
    services.AddSignalR();
}

and

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
    app.UseSignalR(routes =>
    {
        routes.MapHub<ManageHub>("manageHub");
    });
}

url:port/signalr, url:port/signalr/negotiate... return 404

url:port/manageHub return 400 with "Connection ID required"

I not found .MapSignalR()

How use SignalR in ASP .Net Core?

Pawel
  • 31,342
  • 4
  • 73
  • 104
Alexandr Sulimov
  • 1,894
  • 2
  • 24
  • 48
  • have you tried testing it using a client side code? I guess the signalr client libraries would take care of the clientID etc – Neville Nazerane Sep 17 '17 at 14:19
  • Man you are keen tackling an alpha. I'm hanging out for the team to get the core version running too. I'll be interested to see if anyone is keen to post anything this early. – OrdinaryOrange Sep 17 '17 at 14:22
  • OrdinaryOrange yes I too was scared of the alpha and created an .net framework website just for signalr. But at least the set up should still work, or they wouldn't have released it – Neville Nazerane Sep 17 '17 at 14:26

2 Answers2

8

You seem to be using the old client. SignalR for ASP.NET Core does not use the /negotiate endpoint anymore. The new SignalR server is not compatible with old client and the new clients are not compatible with the old SignalR server. Take a look at the announcement and samples

Pawel
  • 31,342
  • 4
  • 73
  • 104
  • What about ASP.NET MVC? –  Sep 24 '19 at 16:51
  • Does not make any difference - MVC is built on top on Asp.NET/Asp.NET Core. – Pawel Sep 24 '19 at 21:32
  • Could you pls have a look at [SignalR “Access to XMLHttpRequest …” error in ASP.NET MVC](https://stackoverflow.com/questions/58027442/signalr-access-to-xmlhttprequest-error-in-asp-net-mvc)? Regards. –  Sep 25 '19 at 09:08
3

First of all, make sure you installed the last official version of SignalR for ASP.NET Core 2.0

Second follow that link How to get SignalR Working in ASP.NET Core 2

Nisarg Shah
  • 14,151
  • 6
  • 34
  • 55
Ahmed Abuelnour
  • 442
  • 5
  • 13