namespace LaunchUrlStudy.SubSite2 { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(); app.UseAuthorization(); app.MapControllers(); //配置启动地址(支持子站点):路由+自定义内容 app.MapGet("/", async context => { //绝对Url string swaggerUrl = Microsoft.AspNetCore.Http.Extensions.UriHelper.BuildAbsolute(context.Request.Scheme, context.Request.Host, context.Request.PathBase, "/swagger/index.html"); //相对Url string swaggerUrl2 = Microsoft.AspNetCore.Http.Extensions.UriHelper.BuildRelative(context.Request.PathBase, "/swagger/index.html"); context.Response.ContentType = "text/html"; var wellcomHtml = $"""