DEV Community

Discussion on: Build a Simple CRUD App with Angular 8 and ASP.NET Core 2.2 - part 1 - back-end

Collapse
 
gavincampbellg2g3 profile image
gavin-campbell-g2g3

Hi Martin,

Thanks for the tutorial.

I encountered an exception though when I tried to run it:
"The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the policy by listing individual origins if credentials needs to be supported"

This was caused by setting both "AllowAnyOrigin()" and "AllowCredentials()" when setting up the CORS policy. However, when I remove "AllowCredentials()" and run it, it says the page cannot be found.

Any suggestions on how to overcome this? Has this requirement come into play since you wrote this tutorial, if not how did it work for you?

Any help would be greatly appreciated.

Thanks,
Gavin

Collapse
 
bogdanhatis profile image
bogdanhatis

Hi Gavin,

Yes, you need to remove the AllowCredentials() to run the solution. After that build the solution and the first page will be Not found and you need to put /api/blogposts into the url for calling the get all method.

Best regards,
Bogdan

Collapse
 
gavincampbellg2g3 profile image
gavin-campbell-g2g3 • Edited

Hi Bogdan,

Thanks for the help. I had realised my error but hadn't had a chance to come back and update my comment.

Thanks again for your help!

Gavin

Collapse
 
dileno profile image
Martin Soderlund Ek

Thanks for clarifying that, Bogdan!