2024-07-30 07:36:42 +00:00
|
|
|
using LocalServer;
|
2024-09-05 01:59:57 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
2024-09-27 07:02:55 +00:00
|
|
|
ConfigurationBuilder configurationBuilder = new();
|
2024-09-05 01:59:57 +00:00
|
|
|
|
|
|
|
//添加配置文件路径
|
|
|
|
configurationBuilder.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
|
2024-06-21 04:32:55 +00:00
|
|
|
|
2024-09-05 01:59:57 +00:00
|
|
|
//加载文件
|
|
|
|
IConfiguration _configuration = configurationBuilder.Build();
|
2024-09-27 07:02:55 +00:00
|
|
|
LocalSyncServer.TempRootFile = _configuration["TempDir"] ?? "C:/TempPack";
|
|
|
|
LocalSyncServer.SqlPackageAbPath =
|
|
|
|
_configuration["SqlPackageAbPath"] ?? "C:\\Users\\ZHAOLEI\\.dotnet\\tools\\sqlpackage.exe";
|
2024-10-11 08:32:36 +00:00
|
|
|
LocalSyncServer.MSBuildAbPath =
|
|
|
|
_configuration["MSBuildAbPath"]
|
|
|
|
?? "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe";
|
2024-09-27 10:41:12 +00:00
|
|
|
|
|
|
|
//LocalSyncServer.MsdeployAbPath =
|
|
|
|
// _configuration["MsdeployAbPath"]
|
|
|
|
// ?? "C:\\Program Files\\IIS\\Microsoft Web Deploy V3\\msdeploy.exe";
|
2024-09-27 07:02:55 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
// Add services to the container.
|
2024-06-21 04:32:55 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
builder.Services.AddControllers();
|
2024-06-21 04:32:55 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
builder.Services.AddSingleton<LocalSyncServerFactory>();
|
2024-06-21 04:32:55 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
var app = builder.Build();
|
2024-09-27 07:02:55 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseSwagger();
|
|
|
|
app.UseSwaggerUI();
|
|
|
|
}
|
2024-10-12 13:38:08 +00:00
|
|
|
DefaultFilesOptions defops = new DefaultFilesOptions();
|
2024-10-17 07:24:30 +00:00
|
|
|
|
|
|
|
//defops.DefaultFileNames.Clear();
|
2024-10-12 13:38:08 +00:00
|
|
|
defops.DefaultFileNames.Add("index.html");
|
|
|
|
app.UseDefaultFiles(defops);
|
|
|
|
app.UseStaticFiles();
|
2024-07-30 07:36:42 +00:00
|
|
|
app.UseWebSockets();
|
|
|
|
app.UseAuthorization();
|
2024-10-17 07:24:30 +00:00
|
|
|
|
|
|
|
//app.Urls.Clear();
|
|
|
|
//app.Urls.Add("http://0.0.0.0:6818");
|
2024-07-30 07:36:42 +00:00
|
|
|
app.MapControllers();
|
2024-06-21 04:32:55 +00:00
|
|
|
|
2024-07-30 07:36:42 +00:00
|
|
|
app.Run();
|