其他分享
首页 > 其他分享> > .net core 跨域

.net core 跨域

作者:互联网

  public void ConfigureServices(IServiceCollection services)

  #region 配置跨域
            //配置跨域处理
            services.AddCors(options => options.AddPolicy("CorsPolicy",
             builder =>
             {
                 builder.AllowAnyMethod()
                     .SetIsOriginAllowed(_ => true)
                     .AllowAnyHeader()
                     .AllowCredentials();
             }));
            #endregion

 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

         #region 配置跨域
            app.UseCors("CorsPolicy");
         
            #endregion

 

标签:core,跨域,endregion,app,void,services,net,public
来源: https://www.cnblogs.com/enych/p/15187845.html