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.
|
|
|
|
|
|
|
|
|
namespace LaunchUrlStudy.DefaultApi
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
// 配置Http请求管道
|
|
|
|
|
|
|
|
|
|
//认证与授权
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
//WebApi
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
|
|
app.Map("/", async context =>
|
|
|
|
|
{
|
|
|
|
|
context.Response.ContentType = "text/html";
|
|
|
|
|
string defaultHtml =
|
|
|
|
|
$"""
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>{AppDomain.CurrentDomain.FriendlyName}</title>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div style="text-align:center">
|
|
|
|
|
<h2>{AppDomain.CurrentDomain.FriendlyName} 启动成功!</h2>
|
|
|
|
|
<h3>此为主站点首页内容</a></h3>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
""";
|
|
|
|
|
await context.Response.WriteAsync(defaultHtml);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//启动
|
|
|
|
|
app.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|