前端是 vue 后端是aspdotnet core 2.2的 webapi
前端调用后端接口的时候不通:
Access to XMLHttpRequest at 'http://127.0.0.1:13037/api/user/authenticate' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
应该是跨域的问题,不知道的怎样才能让这个'Access-Control-Allow-Origin'加出来
接口的Startup中应该是已经用了跨域了
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
// configure strongly typed settings objects
var appSettingsSection = Configuration.GetSection("AppSettings");
services.Configure(appSettingsSection);
// configure jwt authentication
var appSettings = appSettingsSection.Get();
var key = Encoding.ASCII.GetBytes(appSettings.Secret);
services.AddAuthentication(x =>
{