namespace LaunchUrlStudy.SubSite7 { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(); app.UseAuthorization(); app.MapControllers(); // 配置启动地址(支持子站点):静态文件服务器默认页 // 只能是wwwroot里的静态真实文件,不能是"swagger/index.html"(因为它是㠌入的资源文件,不在wwwroot中) app.UseDefaultFiles(new DefaultFilesOptions() { DefaultFileNames = new[] { //可以是静态文件 "index.html", //不能是虚拟文件:因为它是㠌入的资源文件,不在wwwroot中 //"swagger/index.html" } }); app.UseStaticFiles(); app.Run(); } } }