ccruiの博客

ccruiの博客

.net6 API 静态路径

45
2023-08-22

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "Resources")),
RequestPath = "/Resources",
OnPrepareResponse = ctx =>
{
ctx.Context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
}
});