title: AllowAnonymous not working ASP.Net Core 3.0
body: <p>I have a project that I created using VS 2019 and enabled Azure Auth during the setup for the project. I have an issue in which when setting a controller to <code>[AllowAnonymous]</code> the app still asks for the user to authenticate.</p>
  
  <p>I have checked IIS and Allow Anonymous is enabled and am pretty at a loss after a day and a half of googling. Hoping someone can help.</p>
  
  <p>For good measure, here is my Startup.cs:</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.AddAuthentication(AzureADDefaults.AuthenticationScheme)
                  .AddAzureAD(options =&gt; Configuration.Bind("AzureAd", options));
  
              //services.AddAuthorization();
  
              services.AddControllersWithViews(options =&gt;
              {
                  var policy = new AuthorizationPolicyBuilder()
                      .RequireAuthenticatedUser()
                      .Build();
                  options.Filters.Add(new AuthorizeFilter(policy));
              });
              services.AddRazorPages();
  
              // Use SQL Database if in Azure, otherwise, use SQLite
              if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Production")
                  services.AddDbContext&lt;AppDbContext&gt;(options =&gt;
                          options.UseSqlServer(Configuration.GetConnectionString("ProdLibsDbContext")));
  
              else
                  services.AddDbContext&lt;AppDbContext&gt;(options =&gt;
                      options.UseSqlServer(Configuration.GetConnectionString("AppDbContext")));
  
              // Automatically perform database migration
              services.BuildServiceProvider().GetService&lt;AppDbContext&gt;().Database.Migrate();
          }
  
          // 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("/Home/Error");
                  // 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.UseDeveloperExceptionPage();
  
              app.UseHttpsRedirection();
              app.UseStaticFiles();
  
              app.UseRouting();
  
              app.UseAuthentication();
              app.UseAuthorization();
  
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllerRoute(
                      name: "default",
                      pattern: "{controller=Home}/{action=Index}/{id?}");
                  endpoints.MapRazorPages();
              });
          }
      }
  }
  </code></pre>