I have JavaScript application in OpenLayers 3, and my base layer is created from local tiles. I work only in my computer so I do not know why I have CORS error.
I was having the exact same problem. In my case none of the above solutions worked, what did it for me was to add the following:
app.UseCors(builder => builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
So basically, allow everything.
Bear in mind that this is safe only if running locally.