title: Application using CORS does not work in Azure
body: <p>I have configured my application to use CORS. All works perfectly in my local environment, but after deploying the app to Azure, we receive the following error:</p>
  
  <blockquote>
    <p>No 'Access-Control-Allow-Origin' header is present on the requested
    resource.</p>
  </blockquote>
  
  <p>When I run the application on my computer and create the origin header using the DHC chrome extension, it does actually work:</p>
  
  <pre><code>Access-Control-Allow-Credentials:   true
  Access-Control-Allow-Origin:        http://mysite.s3-website-eu-west-1.amazonaws.com
  Access-Control-Expose-Headers:      Location,Finished
  </code></pre>
  
  <p>This is the code/configuration that I use: </p>
  
  <p><strong>Global.asax.cs</strong></p>
  
  <pre><code>protected void Application_Start()
  {
      GlobalConfiguration.Configure(WebApiConfig.Register);
  }
  </code></pre>
  
  <p><strong>WebApiConfig.cs</strong></p>
  
  <pre><code>public static void Register(HttpConfiguration config)
  {
      config.EnableCors(new MyCorsPolicyAttribute());
      config.MapHttpAttributeRoutes();
  }
  </code></pre>
  
  <p><strong>MyCorsPolicyAttribute.cs</strong></p>
  
  <pre><code>public class MyCorsPolicyAttribute : Attribute, ICorsPolicyProvider
  {
      private CorsPolicy _policy;
  
      public MyCorsPolicyAttribute()
      {
          _policy = new CorsPolicy
          {                
              AllowAnyMethod = true,
              AllowAnyHeader = true,
              SupportsCredentials = true
          };
  
          _policy.ExposedHeaders.Add("Location");
          _policy.ExposedHeaders.Add("Finished");
  
          // Add allowed origins.
          _policy.Origins.Add("http://mysite.s3-website-eu-west-1.amazonaws.com");
          _policy.Origins.Add("http://localhost:81");//for testing purposes; 
     }
      public Task&lt;CorsPolicy&gt; GetCorsPolicyAsync(HttpRequestMessage request)
      {
          return Task.FromResult(_policy);
      }
  
      public Task&lt;CorsPolicy&gt; GetCorsPolicyAsync(HttpRequestMessage request, CancellationToken cancellationToken)
      {
          return Task.FromResult(_policy);
      }   
  }
  </code></pre>
  
  <p>and finally the <strong>web.config</strong></p>
  
  <pre><code>&lt;system.webServer&gt;
    &lt;handlers&gt;
      &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
      &lt;remove name="WebDav" /&gt;
      &lt;remove name="OPTIONSVerbHandler" /&gt;
      &lt;remove name="TRACEVerbHandler" /&gt;
      &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt;
    &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>Why doesn't the above work in the Azure enviroment?</p>