title: ASP.NET Core WebAPI Routing
body: <p>I am creating an API using ASP.NET Core, and below is my controller code.</p>
  
  <p>I have given the controller and Startup code below, along with fiddler request/response log. I am getting a 404 Not Found error. Please advise what am I missing?</p>
  
  <pre><code>[Route("api/[controller]")]
  public class UserController : Controller
  {
      [HttpPost]
      public string RegisterUser(User newUser)
      {
          // Code to register user in system
          return succecss/failure message
  
      }
  }
  </code></pre>
  
  <p>I tried suggested attribute routing from 
  <a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/routing" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/routing</a> but still no luck. I am not sure what I am missing.</p>
  
  <p>Please note that with the Web API template , there is no default routing in Startup.cs:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddMvc();
  }
  
  // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      if (env.IsDevelopment())
      {
          app.UseDeveloperExceptionPage();
      }
  
      app.UseMvc();
  }
  </code></pre>
  
  <p>The following is my fiddler request:</p>
  
  <pre><code>URL: http://localhost:8011/api/User/RegisterUser
  
  Verb= post
  
  User-Agent: Fiddler
  Host: localhost:8011
  Content-Type: application/json
  Content-Length: 77
  
  Request body
  {"FirstName": "TEST FirstName", "LastName": "Test Last Name", "EmailId":"A@BB.COM","Password":"1"}
  
  Output in response header:
  HTTP/1.1 404 Not Found
  </code></pre>