I\'m using an angular2 front end and WebApi backend. The webapi is CORS enabled
var cors = new EnableCorsAttribute(\"*\", \"*\", \"*\");
GlobalConfiguration.
Your error message tells that there is no Access-Control-Allow-Origin
in the response of your call. It's something necessary to enable CORS for this request. It's not something related to Angular2.
This is triggered on the client side by the adding of the Origin
header in the request. Do you have this header in your request? Do you use preflighted requests in your other applications. As a reminder:
text/plain
, application/x-www-form-urlencoded
and multipart/form-data
.Perhaps OPTIONS requests aren't correctly handled on the server side (don't return correct headers, ...).
What would be interested is to tell us on which requests the error occurs: the OPTIONS one or the target request. You can have a look at the Network tab in DevTools...
See these links for more details about how CORS works:
Hope it helps you, Thierry