title: No 'Access-Control-Allow-Origin' error when accessing web-api from angular2
body: <p>From one side I have an ASP.net web application that contains a web api module. 
  On the same machine I have an angular 2 client application which is consuming the web api controllers crud methods. The angular 2 uses a basic http service with the uri of the localhost with the port number on which the web api runs on. I run the web api application and when the angular 2 tries to consume a Get request, I get this error message (22770 is the port of the web-api, 4200 is the port of the angular 2 application):</p>
  
  <blockquote>
    <p>Failed to load <a href="http://localhost:22770/api/" rel="nofollow noreferrer">http://localhost:22770/api/</a>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' is therefore not allowed access.</p>
  </blockquote>
  
  <p><strong>Although this is quite a common question, mine is a little bit different:
  CORS is defined as:
  Cross-Origin Resource Sharing (CORS) is a mechanism that uses
  additional HTTP headers to let a user agent gain permission to access
  selected resources from a server on a different origin (domain) than
  the site currently in use</strong></p>
  
  <p>BUT - I'm working with the same domain - on my local machine (localhost).</p>
  
  <p>What is the problem and how can I solve it ?</p>