소스 검색

打开跨域

lcl 1 년 전
부모
커밋
d8cfa4e1f8
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Startup.cs

+ 1 - 1
Startup.cs

@@ -38,7 +38,7 @@ namespace MySystem
             services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
             services.Configure<Setting>(Configuration.GetSection("Setting"));
             // 测试完成后必须注释掉
-            // services.AddCors(option => option.AddPolicy("cors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().SetIsOriginAllowed(_ => true)));//是否允许跨域
+            services.AddCors(option => option.AddPolicy("cors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().SetIsOriginAllowed(_ => true)));//是否允许跨域
             // 测试完成后必须注释掉
             services.Configure<KestrelServerOptions>(x => x.AllowSynchronousIO = true).Configure<IISServerOptions>(x => x.AllowSynchronousIO = true);
             services.AddMvc(options =>