Reputation: 11
My ASP.NET WebAPI call was working perfectly when hosted in debugging mode (I can call from angular, post man etc. with no issues found).
When I host the same WebAPI on IIS and call post methods from Angular, it's giving me an error (I have no issues with the get method). Post and get are working even when calling from post man tool.
192.168.100.12:89/api/Booking/schedules/:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Access to XMLHttpRequest at 'http://192.168.100.12:89/api/Booking/schedules/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Upvotes: 1
Views: 1139
Reputation: 9489
You are trying to access the url at 192.168.100.12 from localhost:3000. Since they are not at the same address, it is considered cross-origin. By default these requests are blocked as a security measure.
Upvotes: 0