title: ASP Net Web API is blocking requests due to CORS policy
body: <p>I'm trying to send some requests from my angular app to my <strong>ASP.NET Web API</strong></p>
  
  <p>Server but the requests are blocked due to the <strong>CORS Policy</strong>.</p>
  
  <p><strong>Error Message:</strong></p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at 'localhost:5000/api/admins/' from origin
    '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' has been blocked by CORS policy:  Cross origin
    requests are only supported for protocol schemes: http, data, chrome,
    chrome-extension, https.</p>
  </blockquote>
  
  <p>I have already tried to allow any hosts, headers and methods but the problem is still remaining.</p>
  
  <p><strong>Here is my CORS Policy:</strong></p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddCors(options =&gt;
      {
          options.AddPolicy(myAllowSpecificOrigins,
          builder =&gt;
          {
              builder.AllowAnyOrigin();
              builder.AllowAnyHeader();
              builder.AllowAnyMethod();
          });
      });
      services.AddMvc(options =&gt; options.EnableEndpointRouting = false);
      services.AddControllers();
  }
  </code></pre>
  
  <p>My Angular app runs on localhost:4200 and my Server on localhost:5000.</p>
  
  <p>I'm happy about any suggestions.</p>