欢迎来到银龙的博客

人生三从境界:昨夜西风凋碧树,独上高楼,望尽天涯路。 衣带渐宽终不悔,为伊消得人憔悴。 众里寻他千百度,蓦然回首,那人却在灯火阑珊处。

.NetCore跨域

 

 

  "App":  {
  "CorsOrigins": "http://manage.l.cn,http://www..cn,https://www.lu.cn,,http://u.cn,https://portal.edu.cn"
  },

 

 

  services.AddCors(options =>
            {
                options.AddPolicy("localhost", builder =>
                {
                    //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                    builder
                        .WithOrigins(
                            // App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
                            _appConfiguration["App:CorsOrigins"]
                                .Split(",", StringSplitOptions.RemoveEmptyEntries)
                                .Select(o => o.RemovePostFix("/"))
                                .ToArray()
                        )
                        .SetIsOriginAllowedToAllowWildcardSubdomains()
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials();
                });
            });

 

posted on 2020-06-20 11:52  银龙科技  阅读(168)  评论(0编辑  收藏  举报

导航