You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB
C#


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();
}
}
}