SignalR 在 ASP .Net 5 RC-1 中不工作

SignalR not working in ASP .Net 5 RC-1

我似乎无法让 SignalR 3 在 ASP .Net 5 RC-1 从 Beta8 升级。我为 SignalR 尝试了最新的 RC1 包,但遇到了以下问题。我尝试了 "Microsoft.AspNet.SignalR.Server": "3.0.0-rc1-15810"

services.AddSignalR();

导致以下错误:

The type 'IServiceCollection' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

app.UseSignalR();

导致了这个:

The type 'IApplicationBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.AspNet.Http.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

当我切换到 "Microsoft.AspNet.SignalR.Server": "3.0.0-rc2-15909" 包时出现运行时错误:

An exception of type 'System.TypeLoadException' occurred in mscorlib.dll but was not handled in user code

Additional information: Could not load type 'Microsoft.AspNet.Http.RequestDelegate' from assembly 'Microsoft.AspNet.Http.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

使用 MyGet 源 "Microsoft.AspNet.SignalR.Server":“3.0.0-rc1-final”

这里是相关的答案,可能会有帮助:

我刚刚测试了这个,它看起来像是对 aspnetmaster myget feed is required, even though this is not mentioned in the installation docs.

的引用

在包含 aspnetmaster 之前,我只能直接或通过指定 rc1-* 来解析 Microsoft.AspNet.SignalR.Server 3.0.0-rc1-15810,这不会针对 rc1-final 构建。包括 aspnetmaster 可以访问 rc1-final.

如果您使用的是 Visual Studio 2015,请转到“工具”>“选项”>“Nuget 程序包管理器”>“程序包源”,然后添加一个名为任意名称的新提要,但源设置为 https://www.myget.org/F/aspnetmaster/api/v3/index.json

如果你不使用 VS2015,或者你不想编辑你的机器范围的配置,add/edit NuGet.config 在你的解决方案根目录中包含一个包源,如下所示;

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="aspnetmaster" value="https://www.myget.org/F/aspnetmaster/api/v3/index.json" />
  </packageSources>
</configuration>

对于正在查看此页面的任何人,aspnetmaster 提要已删除 "Microsoft.AspNet.SignalR.Server":“3.0.0-rc1-final”