title: .net core 5 app blocking due to CORS policy
body: <p>I have created an api using .net core 5.0 but no matter what I do it seems to block my request to it giving the error</p>
  <pre><code>    has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  <p>my code in my startup.cs is</p>
  <pre><code>   public void ConfigureServices(IServiceCollection services)
      {
          services.AddControllers();
          services.AddCors(options =&gt;
          {
              options.AddPolicy(&quot;AllowAnyCorsPolicy&quot;, policy =&gt; policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
          });
          services.AddTransient&lt;IChatLog, LogsData&gt;(provider =&gt; new LogsData());
      }
  
      
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
          app.UseHttpsRedirection();
          app.UseStaticFiles();
          app.UseRouting();
          app.UseCors();
          app.UseAuthorization();
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapControllers();
          });
      }
  </code></pre>
  <p>From what I have read that should allow any requests from anywhere, but for some reason it is still blocking.</p>
  <p>Has anyone any idea what is wrong?</p>