title: Why is my .NET web api controller not being found?
body: <p>We have been developing a .NET MVC application and recently are looking to integrate a webhook for an email service. I'll admit, this is my first attempt at webhooks and Web API, but it looks fairly straight forward.  I've followed several of the best practice and code examples from SendGrid and keep getting the &quot;No type was found that matches the controller named 'xxxxxx'&quot; message. I'm testing locally with Postman and can not get the controller(s) to be found. My initial goal is to test with the most basic configuration and just pass a POST to our web application, parse the data,  and return 'ok'.  </p>
  <p> I've have enabled attribute routing in WebApiConfig.cs, have tested multiple different controller configurations, added &quot;GlobalConfiguration.Configure(WebApiConfig.Register);&quot; to my Global.asax.cs file, and made sure my classes are public.  </p>
  <p>Am I missing something? I've been troubleshooting this for several hours over multiple days and have not been able to figure it out.</p>
  <p>In my postman request I am not sending any parameters, have the content type header set to jason, and am only including  a sample SendGrid event in the body.  I've verified the port number, and am not passing any authentication via http to our local application. The POST request is being sent to the following url: http://localhost:59998/api/sample</p>
  <p>I've followed several stack overflow posts on similar issues and have made sure I'm not shooting myself in the foot (private classes, plural vs singular, api config settings).</p>
  <p>My api config:</p>
  <pre><code>public static class WebApiConfig
  {
      public static void Register(HttpConfiguration config)
      {
          // Web API routes
          config.MapHttpAttributeRoutes();
  
          config.Routes.MapHttpRoute(
              name: &quot;DefaultApi&quot;,             
              routeTemplate: &quot;api/{controller}/{id}&quot;,
              defaults: new { id = RouteParameter.Optional }
              );
      }
  }
  </code></pre>
  <p>I've removed most of the action methods to simplify the code for the controller. All I'm looking to do right now is to accept a POST, debug locally, and return ok.  I've tried with multiple different class types and have back-tracked to just the most simple options possible.</p>
  <p>I have breakpoints set in my controller and I've been troubleshooting with multiple testing variables, which I've removed to clean up the code (example: int test = 0).</p>
  <pre><code>namespace StickerAppWeb.Controllers
  {
      public class SampleController : ApiController
      {
          [HttpPost]
          public string Index()
          {
              return &quot;API method&quot;;
          }
  
          public void Post()
          {
             //int test = 0; //breakpoint here
          }
      }
  }
  </code></pre>
  <p>My Global config:</p>
  <pre><code>namespace StickerAppWeb
  {
      public class MvcApplication : System.Web.HttpApplication
      {
          protected void Application_Start()
          {
              GlobalConfiguration.Configure(WebApiConfig.Register);
  
  
              AreaRegistration.RegisterAllAreas();
              FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
              RouteConfig.RegisterRoutes(RouteTable.Routes);
              BundleConfig.RegisterBundles(BundleTable.Bundles);
  
          }
      }
  }
  </code></pre>
  <p><strong>Update1:
  As a follow-up from yesterday, I also have this project published to Azure and get the same response from Postman when submitting a POST to the application in Azure. Is there any reason that the application is not finding that controller both locally, and in Azure?</strong></p>