我正在尝试在我的MVC应用程序中实现SignalR但是我收到以下错误: 我收到以下错误:
System.Web.Routing.SignalRRouteExtensions.MapHubs(System.Web.Routing.RouteCollection)'
is obsolete: 'Use IAppBuilder.MapSignalR in an Owin Startup class. See http://go.microsoft.com/fwlink/?LinkId=320578
for more details.
在线搜索解决方案后,我偶然发现THIS
所以我添加了启动文件,现在我的代码现在看起来像:
Startup.cs
[assembly: OwinStartup(typeof(MyTestMVCApp.Startup))]
namespace MyTestMVCApp
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
的Global.asax:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
RouteTable.Routes.MapHubs();//error here
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
我仍然遇到同样的错误。我错过了什么?