title: How to define the PUT method in routing only limit to the Put methods in controller without parameter?
body: <p>Here is the routing configuration in WebApiConfig.cs:</p>
  
  <pre><code>config.Routes.MapHttpRoute(
      name: "DefaultApiPut",
      routeTemplate: "api/{controller}",
      defaults: new { httpMethod = new HttpMethodConstraint(HttpMethod.Put) }
  );
  
  
  config.Routes.MapHttpRoute(
      name: "DefaultApi",
      routeTemplate: "api/{controller}/{id}",
      defaults: new { httpMethod = new HttpMethodConstraint(HttpMethod.Get, HttpMethod.Post, HttpMethod.Delete) }
  );
  </code></pre>
  
  <p>Here is my controller:</p>
  
  <pre><code>public class MyController : ApiController {
      [HttpPut]
      public void Put()
      {
          //blah
      }
  }
  </code></pre>
  
  <p>Somehow when the client sents the PUT request with the URL <code>/api/myController/12345</code>, it still maps to the <code>Put</code> method in <code>MyController</code>, I am expecting an error like resource not found.</p>
  
  <p>How to force the <code>Put</code> method only accept the request without a parameter?</p>
  
  <p>Thanks in advance!</p>