瀏覽代碼

打开跨域

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 =>