public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(env.ContentRootPath + "/assets"), OnPrepareResponse = (c) => { c.Context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); }, RequestPath = "/services/v1/assets" }); }
修改返回头部
c.Context.Response.Headers.Add("Access-Control-Allow-Origin", "*");