Commit b6801ac9 by lizefeng

服务端配置跨域

parent 4261ec84
......@@ -26,6 +26,8 @@ namespace AutoTurnOver
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
.AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); })
......@@ -56,6 +58,13 @@ namespace AutoTurnOver
app.UseHttpsRedirection();
app.UseCors(builder =>
builder
.WithOrigins("http://ui.data.com")
.WithHeaders("x-requested-with", "content-type")
.WithMethods("GET", "POST", "PUT", "DELETE")
);
app.UseMvc(routes =>
{
routes.MapRoute(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment