人人人人人人人人人人人人

NET Core3.1 Cors 添加跨域支持

在 Startup 里加:

            services.AddCors(options => options.AddPolicy(
                                 DefaultCors,
                                 p => p.SetIsOriginAllowedToAllowWildcardSubdomains()
                                 .WithOrigins("https://*.cnblogs.com", "http://*.cnblogs.com","https://localhost:44316")
                                 .AllowAnyMethod().AllowAnyHeader()));
        }

 

再在

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{

app.UseCors(DefaultCors);

。。。

}

posted @ 2020-06-10 11:03  wgscd  阅读(631)  评论(0编辑  收藏  举报