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.

36 lines
932 B
C#

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