Commit e9330592011b375fc380995ccf587a98709d8724

Authored by “wangming”
1 parent 1e03c27e

更新 YiAbpWebModule.cs,优化静态资源处理逻辑,添加前端静态资源支持,并调整 API 静态资源访问路径

美国版/Food Labeling Management Code/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs
@@ -379,11 +379,14 @@ namespace Yi.Abp.Web @@ -379,11 +379,14 @@ namespace Yi.Abp.Web
379 //请求处理 379 //请求处理
380 app.UseApiInfoHandling(); 380 app.UseApiInfoHandling();
381 381
382 - //静态资源 382 + //前端静态资源(wwwroot 根目录直接访问)
  383 + app.UseDefaultFiles();
  384 + app.UseStaticFiles();
  385 +
  386 + //API 静态资源(通过 /api/app/wwwroot 路径访问)
383 app.UseStaticFiles(new StaticFileOptions 387 app.UseStaticFiles(new StaticFileOptions
384 { 388 {
385 RequestPath = "/api/app/wwwroot", 389 RequestPath = "/api/app/wwwroot",
386 - // 可以在这里添加或修改MIME类型映射  
387 ContentTypeProvider = new FileExtensionContentTypeProvider 390 ContentTypeProvider = new FileExtensionContentTypeProvider
388 { 391 {
389 Mappings = 392 Mappings =
@@ -392,7 +395,6 @@ namespace Yi.Abp.Web @@ -392,7 +395,6 @@ namespace Yi.Abp.Web
392 } 395 }
393 } 396 }
394 }); 397 });
395 - app.UseDefaultFiles();  
396 app.UseDirectoryBrowser("/api/app/wwwroot"); 398 app.UseDirectoryBrowser("/api/app/wwwroot");
397 399
398 app.Properties.Add("_AbpExceptionHandlingMiddleware_Added", false); 400 app.Properties.Add("_AbpExceptionHandlingMiddleware_Added", false);