title: MVC Api Controller Method HttpPost not working
body: <p>I am using Visual Studio 2013...</p>
  
  <p>I am having some problems with Api Controller Method.</p>
  
  <p>I understand the differences between <code>HTTPGET</code>, <code>HTTPPUT</code>, <code>[FromUri]</code> and <code>[FromBody].</code></p>
  
  <p>I have a simple Method, and I am testing all combination.</p>
  
  <p>When I run</p>
  
  <blockquote>
    <p><a href="http://localhost:62536/api/Controller/Method/10" rel="nofollow noreferrer">http://localhost:62536/api/Controller/Method/10</a></p>
  </blockquote>
  
  <p>I Got HTTP 404 error is this examples</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>[HttpPut]
  public string Method([FromUri] int a)
  {
  return "";
  }
  
  [HttpPut]
  public string Method( int a)
  {
  return "";
  }
  
  [HttpGet]
  public string Method([FromUri] int a)
  {
  return "";
  }
  
  [HttpGet]
  public string Method( int a)
  {
  return "";
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Got HTTP 405 error is this examples</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> [HttpPut]
           public string Method([FromBody] int a)
           {
           }</code></pre>
  </div>
  </div>
  </p>
  
  <p>NO Error, but parameter <code>a</code> is 0..</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> [HttpGet]
           public string Method([FromBody] int a)
           {
               return a.ToString();
           }</code></pre>
  </div>
  </div>
  </p>
  
  <p>In other words.. It does not work using [HttpPut] or using parameter not defined or defined as [FromUri].</p>
  
  <p>It only Works with [HttpGet] and [FromBody], but parameters is null.</p>
  
  <p>My WebApiConfig look like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> public static void Register(HttpConfiguration config)
          {
              config.Routes.MapHttpRoute(
                  name: "DefaultApi",
                  routeTemplate: "api/{controller}/{action}/{id}",
                  defaults: new { id = RouteParameter.Optional }
              );
             
          }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Why it is not working?</p>