title: Registering Api controller routes with MVC project
body: <p>I added one Api controller to my MVC project. And made following changes:</p>
  
  <p>My WebApiConfig</p>
  
  <pre><code>public static class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              config.MapHttpAttributeRoutes();
  
              config.Routes.MapHttpRoute(
                  name: "GetFirms",
                  routeTemplate: "api/B2bApi/GetFirms",
                  defaults: new { controller =  "B2bApiController", action= "GetFirms" });
          }
      }
  </code></pre>
  
  <p>I register this route in Global.asax (Last line)</p>
  
  <pre><code>protected void Application_Start()
  {
      AreaRegistration.RegisterAllAreas();
      FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
      RouteConfig.RegisterRoutes(RouteTable.Routes);
      BundleConfig.RegisterBundles(BundleTable.Bundles);
      GlobalConfiguration.Configure(WebApiConfig.Register);
  }
  </code></pre>
  
  <p>I checked in debugged and saw that my routes are registered. So here is my controller:</p>
  
  <pre><code>public class B2bApiController : ApiController
      {
          [HttpGet]
          public string GetFirms()
          {
              return "test";
          }
      }
  </code></pre>
  
  <p>When i navigate to </p>
  
  <blockquote>
    <p>/api/B2bApi/GetFirms</p>
  </blockquote>
  
  <p>i'm getting </p>
  
  <blockquote>
    <p>404 error</p>
  </blockquote>
  
  <p>. </p>
  
  <p>What is the correct way to register api routes? </p>