当前位置 : 主页 > 网络编程 > ASP >

Owin.IAppBuilder在asp.net中不包含“MapSignalR”错误的定义

来源:互联网 收集:自由互联 发布时间:2021-06-24
我收到了这个错误 Owin.IAppBuilder’ does not contain a definition for ‘MapSignalR’ and no extension method ‘MapSignalR’ accepting a first argument of type ‘Owin.IAppBuilder’ could be found (are you missing a using direc
我收到了这个错误

Owin.IAppBuilder’ does not contain a definition for ‘MapSignalR’ and
no extension method ‘MapSignalR’ accepting a first argument of type
‘Owin.IAppBuilder’ could be found (are you missing a using directive
or an assembly reference?)

这是我的代码

using System;
 using System.Threading.Tasks;
 using Microsoft.Owin;
 using Owin;

 [assembly: OwinStartup(typeof(VirtualClassroom.Startup1))]

 namespace VirtualClassroom
 {
     public class Startup1
        {
           public void Configuration(IAppBuilder app)
               {
                    app.MapSignalR();

               }
        }

}
我搜索了很多,并尝试按堆栈溢出答案
   ‘Owin.IAppBuilder’ does not contain a definition for ‘MapSignalR’我有

1.新增Microsoft.Owin //版本2.0.1

2.添加了Microsoft.Owin.Security //版本2.0.1

3.增加了Microsoft Asp.Net SignalR

但我仍然得到同样的错误.请帮忙.提前致谢!!

看起来你有一个旧版本的Microsoft.AspNet.SignalR.Core.dll,去nuGet并安装这个包,你应该看到这个扩展方法…

然后你应该看到一堆这些方法public static IAppBuilder MapSignalR(这个IAppBuilder构建器);在OwinExtensions下.

编辑:根据评论

转到参考,然后单击此参考的属性…

该版本应类似于以下…

网友评论