Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

APIs throwing CORS error from one web server but are accessible from another domain (Both are in different domains).

$
0
0

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


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>