title: The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time
body: <p>im getting warning error saying </p>
  
  <blockquote>
    <p>"Microsoft.AspNetCore.Cors.Infrastructure.CorsService|The CORS
    protocol does not allow specifying a wildcard (any) origin and
    credentials at the same time. Configure the policy by listing
    individual origins if credentials needs to be supported."</p>
  </blockquote>
  
  <p>code 
  controller</p>
  
  <pre><code>[Route("api/[controller]")]
      [EnableCors("CorsPolicy")]
      [ApiController]
      public class MedPlusController : ControllerBase
      {
      }
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code>  public void ConfigureServices(IServiceCollection services)
              {
                 services.AddDbContext&lt;Context&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
  
                  services.AddCors(options =&gt;
                  {
                      options.AddPolicy("CorsPolicy",
                          builder =&gt; builder.AllowAnyOrigin()
                          .AllowAnyMethod()
                          .AllowAnyHeader()
                          .AllowCredentials());
                  });
  
                  services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
  
              }
  
  
              public void Configure(IApplicationBuilder app, IHostingEnvironment env)
              {
                  if (env.IsDevelopment())
                  {
                      app.UseDeveloperExceptionPage();
                  }
  
                  app.UseCors("CorsPolicy");
  
                  app.UseMvc();
              }
  </code></pre>