I have a ASP.net Web API, that I am trying to host on IIS 10 (Windows 10 Pro). If I access this Web API form Angular 2 app, I get the following error

XMLHttpRequest cannot load http://172.26.50.17:8085/api/library. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 500.

But, If I host the same Web API on the IIS 7 (Windows 7), I do not get the above error. Could someone please help me understand this problem. Why do I need to do on IIS 10 to get rid of this error.

I recall there are rule and security changes from one to the other. We don't use IIS so I'm far from expert but it appears that message means you have work to do. I'll share the search I used to find priors but want to write no, I don't expect you to be able to sling a site from one IIS to another without some work.

Read a few from this search.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.