Reputation: 16433
I have several .NET Core 2.0 Wep Api controllers that work fine, but one gives the client invalid cross origin error even though CORS is initialized globally. I've looked at the controller over and over and I see no difference between it and the others that work fine. My client is an Angular4 app and the only information it provides is that the request isn't allowed because of a CORS violation.
Upvotes: 1
Views: 459
Reputation: 16433
I kept thinking it was a bug in my client code or some bug in .net core 2.0 because it's so new. For some reason I never tried typing the actual get url into the browser on the web api server, had I done that early on I would have seen that there was an exception. Come to find out, one of my POCO data model classes had a field spelled wrong. So my advice is don't depend on your client application when troubleshooting errors with your web api.
Upvotes: 2