title: All ASP.NET Web API controllers return 404
body: <p>I'm trying to get an API Controller to work inside an ASP.NET MVC 4 web app. However, every request results in a <strong>404</strong> and I'm stumped. :/</p>
  
  <p>I have the standard API controller route from the project template defined like:</p>
  
  <pre><code>public static class WebApiConfig
  {
      public static void Register(HttpConfiguration config)
      {
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
      }
  }
  </code></pre>
  
  <p>The registration is invoked in Global.asax:</p>
  
  <pre><code>protected void Application_Start()
  {
      AreaRegistration.RegisterAllAreas();
  
      // Register API routes
      WebApiConfig.Register(GlobalConfiguration.Configuration);
  
      FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  
      RouteConfig.RegisterRoutes(RouteTable.Routes);
  }
  </code></pre>
  
  <p>I have a basic API controller like this:</p>
  
  <pre><code>namespace Website.Controllers
  {
      public class FavoritesController : ApiController
      {       
          // GET api/&lt;controller&gt;
          public IEnumerable&lt;string&gt; Get()
          {
              return new [] { "first", "second" };
          }
  
          // PUT api/&lt;controller&gt;/5
          public void Put(int id)
          {
  
          }
  
          // DELETE api/&lt;controller&gt;/5
          public void Delete(int id)
          {
  
          }
      }
  }
  </code></pre>
  
  <p>Now, when I browse to <strong>localhost:59900/api/Favorites</strong> I expect the <strong>Get</strong> method to be invoked, but instead I get a <strong>404</strong> status code and the following response:</p>
  
  <pre><code>&lt;Error&gt;
     &lt;Message&gt;
         No HTTP resource was found that matches the request URI 'http://localhost:59900/api/Favorites'.
     &lt;/Message&gt;
     &lt;MessageDetail&gt;
        No type was found that matches the controller named 'Favorites'.
     &lt;/MessageDetail&gt;
  &lt;/Error&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated, I'm losing my mind a little bit over here. :) Thanks!</p>