VS2017 Web application CORS: Access-Control-Allow-Origin

前端 未结 2 1865
醉酒成梦
醉酒成梦 2021-01-24 09:04

I\'m using Angular 6+ for a small website presenting a CRUD to a SQL Database. I know Angular is a client-side framewor

2条回答
  •  梦毁少年i
    2021-01-24 09:25

    I have similar working in a hobby project, so I can show you what I did to get it working...

    I did this in my Startup.cs

    app.UseCors(options => options.WithOrigins(Configuration["trustedCors"].Split(' ')).AllowAnyMethod().AllowAnyHeader());

    with this in my config file ...

    "trustedCors": "http://localhost:60000 https://localhost:60000 http://glendesktop:60000 https://glendesktop:60000"

    I also remember from my testing that case in important for CORS.

提交回复
热议问题