API is throwing CORS Error on one server but running well on another(Both are in different domains) RRS feed

  • Question

  • User455053329 posted

    Hello All,

            I have created a web API in the asp.Net core and enabled cors in the startup.cs file. After deployment windows server APIs are accessible via AJAX from another domain. But when I am hosting the APIs on another windows server it is throwing the following error:-

    "Failed to load http://someDomian/api/APIName: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:57515, *', but only one is allowed. Origin 'http://localhost:57515' is therefore not allowed access."

    I am wondering why APIs are giving errors on one web server while they are accessible from another web server.

    Thanks in advance.

    Friday, October 13, 2017 3:20 PM

All replies