aherrick
aherrick

Reputation: 20169

SignalR ASP.NET MVC 4 Windows 8 Visual Studio 2012 JS Hubs Cannot be Found

I running this super simple SignalR test app that I wrote in VS 2012 / MVC 4 / Win8.

When I run I get the following error everytime. For some reason it looks like it cannot load /signalr/hubs JS.

enter image description here

What am I doing wrong? You can grab the solution from here.

http://andrewherrick.com/spike/SignalR_AJ_Hi.zip

Upvotes: 1

Views: 459

Answers (2)

amit_g
amit_g

Reputation: 31250

Two things

  1. RouteTable.Routes.MapHubs(); is included after RouteConfig.RegisterRoutes(RouteTable.Routes);. It should be included before any other routes. SignalR FAQ.
  2. Your project is not compiling the Global.asax.cs (at least the version I downloaded). You can test this by inserting some invalid code in the file Global.asax.cs and the project would still compile. Exclude it it from the project. Do a clean and full rebuild. Include it back and then do a full rebuild. Make sure that you do get the compilation errors for the invalid code (so that you know that it is being compiled). Remove the invalid code and recompile.

Upvotes: 3

N. Taylor Mullen
N. Taylor Mullen

Reputation: 18301

In your app start do:

RouteTable.Routes.MapHubs();

See the Why does signalr/hubs return 404 or Why do I get 'myhub' is undefined? section in: https://github.com/SignalR/SignalR/wiki/Faq

Upvotes: 1

Related Questions