转自:https://blog.csdn.net/sD7O95O/article/details/130002295
静态文件解决跨域代码如下:
1 app.UseStaticFiles(new StaticFileOptions 2 { 3 OnPrepareResponse = (c) => 4 { 5 c.Context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); 6 c.Context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS, TRACE, HEAD, PATCH"); 7 c.Context.Response.Headers.Add("Access-Control-Allow-Headers", "*"); 8 } 9 });
标签:Core,UseStaticFiles,C#,Access,Headers,Add,Allow,Response From: https://www.cnblogs.com/gzy2016Blog/p/17876905.html