WebApi允许跨域

            services.AddCors(options =>
            {
                options.AddPolicy("abc", builder =>
                {
                    //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                    builder
                      .SetIsOriginAllowed(_ => true)
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials();

                });
            });
     app.UseCors("abc");

 

posted @ 2020-08-19 14:06  IWing  阅读(41)  评论(0编辑  收藏