feat: 为files添加了静态文件服务器管理
parent
17e86eb214
commit
3812a46e2f
|
@ -2,6 +2,7 @@ using System.Text.Json;
|
|||
using AicsKnowledgeBase_file.Handlers;
|
||||
using AicsKnowledgeBase_file.Models;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
|
||||
Directory.CreateDirectory("./files");
|
||||
|
||||
|
@ -41,6 +42,11 @@ if (app.Environment.IsDevelopment()) {
|
|||
|
||||
app.MapGet("/hello", () => "hello");
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions {
|
||||
FileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath, "files")),
|
||||
RequestPath = "/static"
|
||||
});
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.MapControllers();
|
||||
|
|
Loading…
Reference in New Issue