As suggested here, it is different than what is here. Follow these steps:
- Install CORS with this NuGet command:
install-package Microsoft.AspNetCore.Cors
- services.AddCors();
...goes in the ConfigureServices method of Startup.cs just before...
services.AddMvc();
- app.UseCors(builder =>
builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
...goes in the Configure method of Startup.cs just before...
app.UseMvc();
I have, this weekend, made a dummy Hello World project that shows off Angular 4 and .NET Core 2.0 playing nicely together complete with tests on both sides of the wire and IoC on both sides of the wire. If you'd like to take a look you may see it here. The CORS thing is one of many challenges I fought with to make this happen.
No comments:
Post a Comment