gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 08:14:49 24 4
gpt4 key购买 nike

我似乎无法让 SignalR 3 在从 Beta8 升级的 ASP .Net 5 RC-1 上运行。我为 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'.

最佳答案

我刚刚测试了这个,它看起来像是对 aspnetmaster myget feed 的引用是必需的,即使这在 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,或者您不想编辑您的机器范围的配置,请在您的解决方案根目录中添加/编辑 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>

关于c# - SignalR 在 ASP .Net 5 RC-1 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33866010/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com