title: Web api core returns 404 when adding Authorize attribute
body: <p>I am new to .net core, and I am trying to create web api core which implements jwt for authentication and authorization purposes.</p>
  
  <p>Inside Startup class I configured it this way:</p>
  
  <pre><code>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.AddDbContext&lt;MandarinDBContext&gt;(options =&gt;
              options.UseSqlServer(Configuration.GetConnectionString("MyConnection")));
  
          services.AddIdentity&lt;User, Role&gt;()
          .AddEntityFrameworkStores&lt;MyDBContext&gt;()
          .AddDefaultTokenProviders();
  
          services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
                  .AddJwtBearer(options =&gt;
                  {
                      options.TokenValidationParameters = new TokenValidationParameters
                      {
                          ValidateIssuer = false,
                          ValidateAudience = false,
                          ValidateLifetime = true,
                          ValidateIssuerSigningKey = true,
                          ValidIssuer = "yourdomain.com",
                          ValidAudience = "yourdomain.com",
                          IssuerSigningKey = new SymmetricSecurityKey(
                              Encoding.UTF8.GetBytes("My secret goes here"))
                      };
  
                      options.RequireHttpsMetadata = false;
                  });
  
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  
          // Add application services.
          services.AddTransient&lt;IUserService, UserService&gt;();
      }
  
      // 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();
          }
          else
          {
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
  
          app.UseAuthentication();
          app.UseMvc();
      }
  }
  </code></pre>
  
  <p>But when I try to call the following action:</p>
  
  <pre><code>    [Authorize]
      [HttpGet]
      [Route("api/Tokens")]
      public IActionResult TestAuthorization()
      {
          return Ok("You're Authorized");
      }
  </code></pre>
  
  <p>I get 404 not found. If I remove Authorize attribute it's working .</p>
  
  <p>Could you please guide me to solve that issue?</p>