From an Angular 8 client I want to read a file located at: C:\inetpub\wwwroot IIS is running. I used the following code and got this error:
Access to XMLHttpRequest at 'http://localhost/MyFile.xml' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
In IIS configuration I added: Access-Control-Allow-Origin, * to: HTTP Response Headers.
But I got the above error also when IIS was stopped.
Can you please explain what is wrong ?
Thank you in advance, Zvika
let headers = new HttpHeaders;
headers.append ('Access-Control-Allow-Origin','*');
this.http.get ('http://localhost:80/dwell.xml',{headers: 
headers}).subscribe(
  (val) => {
      console.log("GET call successful value returned in body", 
                  val);
  },
  response => {
      console.log("GET call in error", response);
  },
  () => {
      console.log("The GET observable is now completed.");
  });
 
     
    