Qc 之前
This commit is contained in:
@@ -12,6 +12,7 @@ using DOAN.Common.DynamicApiSimple.Extens;
|
||||
using DOAN.Infrastructure.WebExtensions;
|
||||
using DOAN.ServiceCore.Signalr;
|
||||
using DOAN.ServiceCore.SqlSugar;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
// NLog: Setup NLog for Dependency injection
|
||||
@@ -134,6 +135,19 @@ app.Use((context, next) =>
|
||||
return next();
|
||||
});
|
||||
//开启访问静态文件/wwwroot目录文件,要放在UseRouting前面
|
||||
|
||||
var fileProvider = new PhysicalFileProvider(InternalApp.Configuration.GetSection("Upload").GetSection("rootDirectory").Get<string>());
|
||||
var requestPath = "/device";
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = fileProvider,
|
||||
RequestPath = requestPath
|
||||
});
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = fileProvider
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
//开启路由访问
|
||||
app.UseRouting();
|
||||
@@ -165,5 +179,14 @@ app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
app.UseDirectoryBrowser(new DirectoryBrowserOptions
|
||||
{
|
||||
FileProvider = fileProvider,
|
||||
RequestPath = requestPath
|
||||
});
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user