Talk is cheap,show the Code

  • 1
    2
    3
    4
    5
    6
    7
    services.AddCors(options
    => options.AddPolicy("AllowAllOrigin", builder
    => builder.WithOrigins()
    .AllowAnyMethod()
    .AllowAnyHeader()
    .AllowAnyOrigin()
    .AllowCredentials()));
  • 1
    app.UseCors("AllowAllOrigin");
  • 1
    2
    ///在允许跨域的控制器上该代码
    [EnableCors("AllowAllOrigin")]