title: /signalr/hubs not loading in asp.net mvc4: Throws 404
body: <p>Here is what I did. </p>
  
  <ol>
  <li>I used nuget to get the SignalR for my MVC4 project. </li>
  <li>Created a MyHub class in my controller (SignalRTestController.cs)</li>
  <li>In the Index Action, tried to broadcast a message from outside the hub and returned the view.</li>
  <li>In the View, referenced all the scripts and /signalr/hubs.</li>
  </ol>
  
  <p>Problem is /signalr/hubs not being found (throws 404).</p>
  
  <p>My project has areas and is structured as shown:</p>
  
  <ol>
  <li>MVCProject
  <ul>
  <li>Areas
  <ul>
  <li>SubFolder
  <ul>
  <li>Controller
  <ul>
  <li>SignalRTestController.cs</li>
  </ul></li>
  <li>Model</li>
  <li>View
  <ul>
  <li>Index.cshtml</li>
  </ul></li>
  </ul></li>
  </ul></li>
  <li>Controller</li>
  <li>Model</li>
  <li>View</li>
  <li>Scripts</li>
  </ul></li>
  </ol>
  
  <p>All the scripts for signalR are inside the Scripts folder and my SignalRTestController.cs looks like this:</p>
  
  <pre><code>namespace SignalRTest.Controllers
  {
  public class SignalRTestController : Controller
  {
      public ActionResult Index()
      {
          // Do some work here
  
          // Broadcasting over a Hub from outside of a Hub
          var context = GlobalHost.ConnectionManager.GetHubContext&lt;MyHub&gt;();
          context.Clients.say("Hello SignalR!");
  
         return View();
      }
  }
  
  [HubName("MyHub")]
  public class MyHub : Hub
  {
      public void Say(string message)
      {
          Clients.sendMessage(message);
      }
  }
  }
  </code></pre>
  
  <p>Any my Index.cshtml has reference to all the javascripts and the /signalr/hubs too like below:
  // Other Javascripts</p>
  
  <p>script type="text/javascript" src="/signalr/hubs" /></p>
  
  <p>I think the controller is fine, but I'm not getting /signalr/hubs. It is throwing 404 and the message in Chrome Console is like this:</p>
  
  <p>Resource interpreted as Script but transferred with MIME type text/html: "http://www.myproject.com/signalr/hubs".
  Uncaught SyntaxError: Unexpected token &lt; hubs:2
  Uncaught SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. 
  script src='/signalr/hubs'>. </p>
  
  <p>The reason the script is returned as html is the server is returning 404 not found. </p>
  
  <p>I'm not sure what is wrong. I think this might be a routing issue. I'm not sure, if we need to add any routing information on the project for /signalr/hubs or am I missing something here.</p>
  
  <p>FYI: When I create a new empty MVC project and add signalR and start working on it, it works perfectly fine. No need to add routing.</p>
  
  <p>Also, I use both default routing and attribute routing in some places. But the controller SignalRTestController does not use attribute routing.</p>