SignalR "signalr/hubs" giving 404 error
Try call RouteTable.Routes.MapHubs() before RouteConfig.RegisterRoutes(RouteTable.Routes) in Global.asax.cs if you use MVC 4. It works for me.
RouteTable.Routes.MapHubs();
RouteConfig.RegisterRoutes(RouteTable.Routes);
It could be that you haven't added a reference to SignalR.AspNet.dll
. If I recall correctly it's responsible for adding the route to /signalr/hubs
.
From the SignalR 1.0.0 RC2 there is a README in the packages folder that says the Hubs route must be manually established. :) Here is a snippet...
using System;
using System.Web;
using System.Web.Routing;
namespace MyWebApplication
{
public class Global : System.Web.HttpApplication
{
public void Application_Start()
{
// Register the default hubs route: ~/signalr
RouteTable.Routes.MapHubs();
}
}
}
In my case, the main reason of this 404 is hubs were not properly mapped. RouteTable.Routes.MapHubs();
is now obsolete. For mapping hubs you can create a startup class as below.
[assembly: OwinStartup(typeof(WebApplication1.Startup))]
namespace WebApplication1
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
}