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

时间:2017-09-17 14:08:54

标签: c# asp.net-mvc signalr asp.net-core-signalr

我将SignalR添加到ASP .Net Core 2 app

  • “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();
}

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 ... 返回404

url:port / manageHub 返回400,并显示“需要连接ID”

我没找到.MapSignalR()

如何在ASP .Net Core中使用SignalR?

2 个答案:

答案 0 :(得分:5)

您似乎在使用旧客户端。 SignalR for ASP.NET Core不再使用/negotiate端点。新的SignalR服务器与旧客户端不兼容,新客户端与旧的SignalR服务器不兼容。请查看announcementsamples

答案 1 :(得分:3)

首先,请确保安装了SignalR for ASP.NET Core 2.0

的最新正式版本

第二次关注该链接How to get SignalR Working in ASP.NET Core 2