clq1010 8 vuotta sitten
vanhempi
commit
2425204109
1 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. 10 1
      ServiceWechat/ServiceWechat/Startup.cs

+ 10 - 1
ServiceWechat/ServiceWechat/Startup.cs

@@ -30,6 +30,15 @@ namespace ServiceWechat.Api
30 30
         // This method gets called by the runtime. Use this method to add services to the container.
31 31
         public void ConfigureServices(IServiceCollection services)
32 32
         {
33
+
34
+            services.AddCors(options =>
35
+            {
36
+                options.AddPolicy("CorsDev",
37
+                builder => builder.AllowAnyOrigin()
38
+                .AllowAnyMethod()
39
+                .AllowAnyHeader()
40
+                .AllowCredentials());
41
+            });
33 42
             services.AddMvc();
34 43
 
35 44
         }
@@ -41,7 +50,7 @@ namespace ServiceWechat.Api
41 50
             {
42 51
                 app.UseDeveloperExceptionPage();
43 52
             }
44
-
53
+            app.UseCors("CorsDev");
45 54
             app.UseMvc();
46 55
             app.UseStaticFiles(); // For the wwwroot folder
47 56