.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

 

上一篇:WPF 多值转换器


下一篇:JVM学习笔记-运行时数据区