I am trying to enable cross origin resources sharing on my ASP.NET Core Web API, but I am stuck.
The EnableCors attribute accepts policyName
If you are hosting on IIS, one possible reason is you are getting this is because IIS is blocking OPTIONS verb. I spent almost an hour because of this:
One telltale indication is you are getting 404 error during OPTIONS request.
To fix this, you need to explicitly tell IIS not to block OPTIONS request.
Go to Request Filtering:
Make sure OPTIONS is allowed:
Or, just create a web.config with the following setting: