SignalR /signalr/hubs 404 Not Found
The reason of this 404 error is hubs are not mapped, previously it would have to be done as answered by SimonF. If you are using SignalR version 2 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();
}
}
}
referenace : http://www.asp.net/signalr/overview/releases/upgrading-signalr-1x-projects-to-20
If you are working on webforms, Please take the following steps
In the webconfig:
<validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"/>
In the page add reference to hub as
<script src="/signalr/signalr/hubs"></script>
instead of
<script src="/signalr/hubs"></script>
The order of route registration matters. I had this exact problem and fixed it by ensuring my global.asax.cs looked like this:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteTable.Routes.MapHubs();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
This was in a web site using SignalR, MVC and WebApi all together.
Try adding a wildcard application map to your server to help map the unknown extension in the script URL "~/signalr/hubs"