forked from WangGithubUser/FastGitHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
49 lines (44 loc) · 1.34 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Microsoft.AspNetCore.Builder;
using System;
using System.IO;
namespace FastGithub
{
class Program
{
/// <summary>
/// 程序入口
/// </summary>
/// <param name="args"></param>
public static void Main(string[] args)
{
ConsoleUtil.DisableQuickEdit();
var contentRoot = Path.GetDirectoryName(Environment.ProcessPath);
if (string.IsNullOrEmpty(contentRoot) == false)
{
Environment.CurrentDirectory = contentRoot;
}
var options = new WebApplicationOptions
{
Args = args,
ContentRootPath = contentRoot
};
CreateWebApplication(options).Run(singleton: true);
}
/// <summary>
/// 创建host
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
private static WebApplication CreateWebApplication(WebApplicationOptions options)
{
var builder = WebApplication.CreateBuilder(options);
builder.ConfigureHost();
builder.ConfigureWebHost();
builder.ConfigureConfiguration();
builder.ConfigureServices();
var app = builder.Build();
app.ConfigureApp();
return app;
}
}
}