title: can only post to post method in asp.net core webapi
body: <p>I have created non-core webapi projects to interact with mobile apps. for example If I created a controller called Data and it has a method called Search like show below. the project has been configured to send and receive json data.</p>
  
  <pre><code>[HttpPost]
  public Searchresult search(SearchQuery s)
  {
     // code to search
      return sr; //object of type Searchresult
  }
  </code></pre>
  
  <p>I could send post request to this method using postman by using the following url
       <a href="http://localhost/api/Data/search" rel="nofollow noreferrer">http://localhost/api/Data/search</a></p>
  
  <p>Similarly I can create other functions inside the controller and call them using the route '/api/[controller]/[action]'.</p>
  
  <p>I could not do the same in asp.netcore web api project. The routing was controller level i.e '/api/[controller]' and every time I posted only the post method was hit. implemented int eh following way. It gets executed when I post to '<a href="http://localhost/api/Data" rel="nofollow noreferrer">http://localhost/api/Data</a>'</p>
  
  <pre><code>[HttpPost]
  public string Post([FromBody] testclass t)
  {
      return "{\"a\":\"" + t.a + "\",\"b\":\"" + t.b + "\"}";
  }
  </code></pre>
  
  <p>The following code is never executed when I post to "<a href="http://localhost/api/Data/test" rel="nofollow noreferrer">http://localhost/api/Data/test</a>"</p>
  
  <pre><code>    [HttpPost]
      public string test([FromBody] testclass t)
      {
          return "{\"a\":\""+t.a+"\",\"b\":\""+t.b+"\"}";
      }
  </code></pre>