Compare commits
No commits in common. "16ca1b28fc5eaa343f26e309af2d95c3528567a5" and "e6976b42197371da46192eba986f17df6aa0e41d" have entirely different histories.
16ca1b28fc
...
e6976b4219
@ -8,7 +8,6 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.FileProviders;
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Microsoft.Extensions.FileProviders;
|
|
||||||
using Serilog.Sinks.MariaDB.Extensions;
|
using Serilog.Sinks.MariaDB.Extensions;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
@ -160,15 +159,10 @@ app.Use(async (context, next) =>
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var uploadsPath = Path.Combine(Directory.GetCurrentDirectory(), "uploads");
|
|
||||||
if (!Directory.Exists(uploadsPath))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(uploadsPath); // 如果目录不存在,创建它
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
FileProvider = new PhysicalFileProvider(uploadsPath),
|
FileProvider = new PhysicalFileProvider(
|
||||||
|
Path.Combine(Directory.GetCurrentDirectory(), "uploads")),
|
||||||
RequestPath = "/uploads"
|
RequestPath = "/uploads"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user