记一次小型项目部署的问题(AspNetCore Api与 前端 一起部署到iis相同站点)

AspNetCore 与 前端页面 进行统一部署

 1             app.UseStaticFiles();//开启静态文件
 2 
 3             app.UseEndpoints(endpoints =>
 4             {
 5                 endpoints.MapGet("/",async context =>
 6                 {
 7                     context.Response.Redirect("/index.html");
 8                     await Task.FromResult(true);
 9                 });
10                 endpoints.MapControllers();
11             });

默认部署是 wwwroot 文件夹以下,还可以通过 UseStaticFiles 进行指定物理文件夹路径。

posted on 2021-02-04 17:14  不会非的猪  阅读(187)  评论(0编辑  收藏  举报

导航