MapHubs not needed in SignalR 1.01?

北战南征 提交于 2019-12-06 03:58:39

问题


I am following the Hubs Quick Start Guide in the Signalr Wiki. I get an error in Global.asax, Application_Start on the line RouteTable.Routes.MapHubs().

A route named 'signalr.hubs' is already in the route collection. Route names must be unique. Parameter name: name

Maybe this is not needed anymore in 1.0.1? It worked fine in 1.0. It is also mentioned in the readme.txt from NuGet that we need the MapHubs command.

System.ArgumentException was unhandled by user code Message=A route named 'signalr.hubs' is already in the route collection. Route names must be unique. Parameter name: name Source=System.Web
ParamName=name StackTrace: at System.Web.Routing.RouteCollection.Add(String name, RouteBase item) at System.Web.Routing.RouteCollectionExtensions.Add[T](RouteCollection routes, String name, T item) at System.Web.Routing.RouteCollectionExtensions.MapOwinPath(RouteCollection routes, String name, String pathBase, Action`1 startup) at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection routes, String name, String path, HubConfiguration configuration) at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection routes, String path, HubConfiguration configuration) at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection routes, HubConfiguration configuration) at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection routes) at SignalrServer.Global.Application_Start(Object sender, EventArgs e) in C:\RC\Code\Signalr\SignalrServer\SignalrServer\Global.asax.cs:line 18 InnerException:


回答1:


You need it. Looks like you're calling it twice in your app, don't do that. If you're not explicitly calling it twice then you have and older version of signalr that used to call it for you lying around somewhere in your bin folder. Delete it all and it should work.



来源:https://stackoverflow.com/questions/16166040/maphubs-not-needed-in-signalr-1-01

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!