Asp .Net Core 2 + SignalR (1.0.0-alpha2-27025) + /signalr/negotiate 404 Error

陌路散爱 提交于 2021-02-07 14:15:40

问题


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?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/46264982/asp-net-core-2-signalr-1-0-0-alpha2-27025-signalr-negotiate-404-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!