namespace LaunchUrlStudy.SubSite3 { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); // 配置IoC builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); // 配置请求管道 app.UseSwagger(); app.UseSwaggerUI(); app.UseAuthorization(); app.MapControllers(); //配置启动地址(支持子站点):路由+html文件 app.Map("/", async context => { context.Response.ContentType = "text/html"; await context.Response.SendFileAsync(Path.Combine(app.Environment.ContentRootPath, "index.html")); }); app.Run(); } } }