{"action":"created","issue":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1441","repository_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1441/labels{/name}","comments_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1441/comments","events_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1441/events","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1441","id":181664704,"number":1441,"title":"CORS for Core project","user":{"login":"gabrielrobert","id":5783827,"avatar_url":"https://avatars.githubusercontent.com/u/5783827?v=3","gravatar_id":"","url":"https://api.github.com/users/gabrielrobert","html_url":"https://github.com/gabrielrobert","followers_url":"https://api.github.com/users/gabrielrobert/followers","following_url":"https://api.github.com/users/gabrielrobert/following{/other_user}","gists_url":"https://api.github.com/users/gabrielrobert/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielrobert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielrobert/subscriptions","organizations_url":"https://api.github.com/users/gabrielrobert/orgs","repos_url":"https://api.github.com/users/gabrielrobert/repos","events_url":"https://api.github.com/users/gabrielrobert/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielrobert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-10-07T13:09:48Z","updated_at":"2016-10-18T07:40:43Z","closed_at":null,"body":"I'm trying to call APP service API from another application. I put these in my Startup.cs:\r\n\r\n\r\n```\r\npublic IServiceProvider ConfigureServices(IServiceCollection services)\r\n        {\r\n            //CORS\r\n            var corsBuilder = new CorsPolicyBuilder();\r\n            corsBuilder.AllowAnyHeader();\r\n            corsBuilder.AllowAnyMethod();\r\n            corsBuilder.AllowAnyOrigin();\r\n            corsBuilder.AllowCredentials();\r\n\r\n            services.AddCors(options =>\r\n            {\r\n                options.AddPolicy(\"AllowAll\", corsBuilder.Build());\r\n            });\r\n\r\n            // MVC\r\n            services.AddMvc(options =>\r\n            {\r\n                options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());\r\n            });\r\n\r\n            //Configure Abp and Dependency Injection\r\n            return services.AddAbp<TemplWebModule>(options =>\r\n            {\r\n                //Configure Log4Net logging\r\n                options.IocManager.IocContainer.AddFacility<LoggingFacility>(\r\n                    f => f.UseAbpLog4Net().WithConfig(\"log4net.config\")\r\n                );\r\n            });\r\n        }\r\n```\r\n```\r\n public void Configure(IApplicationBuilder app)\r\n        {\r\n            app.UseAbp();\r\n\r\n            AuthConfigurer.Configure(app, _appConfiguration);\r\n\r\n            app.UseStaticFiles();\r\n            \r\n            app.UseAppBuilder(ConfigureOwinServices);\r\n\r\n            app.UseCors(\"AllowAll\");\r\n            app.UseMvc(routes =>\r\n            {\r\n                routes.MapRoute(\r\n                    name: \"defaultWithArea\",\r\n                    template: \"{area}/{controller=Home}/{action=Index}/{id?}\");\r\n\r\n                routes.MapRoute(\r\n                    name: \"default\",\r\n                    template: \"{controller=Home}/{action=Index}/{id?}\");\r\n            });\r\n        }\r\n```\r\n\r\nI still have this issue:\r\n\r\n`XMLHttpRequest cannot load http://localhost:5102/api/services/app/Test/Get?id=9b1576ac-8be9-4f05-24e4-08d3eeaf7b71. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://testproject.local' is therefore not allowed access. The response had HTTP status code 500.`\r\n\r\n\r\nI even tried to put this on my application service interface:\r\n` [EnableCors(\"AllowAll\")]`"},"comment":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/comments/254430874","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1441#issuecomment-254430874","issue_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1441","id":254430874,"user":{"login":"hikalkan","id":1210527,"avatar_url":"https://avatars.githubusercontent.com/u/1210527?v=3","gravatar_id":"","url":"https://api.github.com/users/hikalkan","html_url":"https://github.com/hikalkan","followers_url":"https://api.github.com/users/hikalkan/followers","following_url":"https://api.github.com/users/hikalkan/following{/other_user}","gists_url":"https://api.github.com/users/hikalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/hikalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hikalkan/subscriptions","organizations_url":"https://api.github.com/users/hikalkan/orgs","repos_url":"https://api.github.com/users/hikalkan/repos","events_url":"https://api.github.com/users/hikalkan/events{/privacy}","received_events_url":"https://api.github.com/users/hikalkan/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T07:40:43Z","updated_at":"2016-10-18T07:40:43Z","body":"You should add ``app.UseCors(\"AllowAll\");`` before UserMvc, otherwise it can not work. I suggest you to add it just after ``UseAbp``."}}
{"actor":{"display_login":"hikalkan"}}