title: REST-Api not working ControllerBase - 404 error (C# .Net Core)
body: <p>I'm trying to set up a Rest-API for my C# and .Net Core web application. While using the standard ASP.NET Core Web App template and adding a Controller to the package with API Controller with read/write action, I thought that the URL: https://localhost:5001/api/values would give me a response. Instead it returns an error (404).</p>
  <p>The ValuesController.cs code:</p>
  <pre><code>using Microsoft.AspNetCore.Mvc;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  
  // For more information on enabling Web API for empty projects, visit 
  https://go.microsoft.com/fwlink/?LinkID=397860
  
  namespace CSharp_met_database.Controllers
  {
  [Route(&quot;api/[controller]&quot;)]
  [ApiController]
  public class ValuesController : ControllerBase
  {
      // GET: api/&lt;ValuesController&gt;
      [HttpGet]
      public IEnumerable&lt;string&gt; Get()
      {
          return new string[] { &quot;value1&quot;, &quot;value2&quot; };
      }
  
      // GET api/&lt;ValuesController&gt;/5
      [HttpGet(&quot;{id}&quot;)]
      public string Get(int id)
      {
          return &quot;value&quot;;
      }
  
      // POST api/&lt;ValuesController&gt;
      [HttpPost]
      public void Post([FromBody] string value)
      {
      }
  
      // PUT api/&lt;ValuesController&gt;/5
      [HttpPut(&quot;{id}&quot;)]
      public void Put(int id, [FromBody] string value)
      {
      }
  
      // DELETE api/&lt;ValuesController&gt;/5
      [HttpDelete(&quot;{id}&quot;)]
      public void Delete(int id)
      {
      }
    }
  }
  </code></pre>
  <p>Maybe I'm missing something because I'm new to C# and .Net Core.</p>
  <p><strong>Edit</strong></p>
  <p>Startup.cs code:</p>
  <pre><code>using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.AspNetCore.HttpsPolicy;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using Microsoft.Extensions.Hosting;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  
  namespace CSharp_met_database
  {
  public class Startup
  {
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddRazorPages();
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseExceptionHandler(&quot;/Error&quot;);
              // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
          app.UseStaticFiles();
  
          app.UseRouting();
  
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapRazorPages();
          });
      }
    }
  }
  </code></pre>