Jelajahi Sumber

打开跨域

lcl 1 tahun lalu
induk
melakukan
d8cfa4e1f8
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  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 =>