5

我正在关注 Signalr Wiki 中的 Hubs 快速入门指南。我在 RouteTable.Routes.MapHubs() 行上的 Global.asax、Application_Start 中遇到错误。

名为“signalr.hubs”的路由已在路由集合中。路由名称必须是唯一的。参数名称:名称

也许这在 1.0.1 中不再需要了?它在 1.0 中运行良好。NuGet 的 readme.txt 中也提到我们需要 MapHubs 命令。

System.ArgumentException 未被用户代码处理 Message=名为“signalr.hubs”的路由已在路由集合中。路由名称必须是唯一的。参数名称:name Source=System.Web
ParamName=name StackTrace:在 System.Web.Routing.RouteCollectionExtensions.Add[T](RouteCollection 路由,字符串名称,T 项)在 System.Web 的 System.Web.Routing.RouteCollection.Add(字符串名称,RouteBase 项)。 System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection routes, String name, String path, HubConfiguration configuration) at System.Web.Routing 的 Routing.RouteCollectionExtensions.MapOwinPath(RouteCollection routes, String name, String pathBase, Action`1 startup)。在 System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection routes, HubConfiguration configuration) 在 System.Web.Routing.SignalRRouteExtensions 的 SignalRRouteExtensions.MapHubs(RouteCollection routes, String path, HubConfiguration configuration)。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:

4

1 回答 1

6

你需要它。看起来你在你的应用程序中调用了两次,不要那样做。如果你没有明确地调用它两次,那么你有一个旧版本的信号器,它曾经为你在你的 bin 文件夹中的某个地方调用它。全部删除,它应该可以工作。

于 2013-04-23T09:43:35.670 回答