You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
50 lines
1.7 KiB
using Serilog;
|
|
using Volo.Abp.IO;
|
|
using Volo.Abp.Modularity.PlugIns;
|
|
|
|
namespace LY.MicroService.Applications.Single;
|
|
|
|
public class Program
|
|
{
|
|
public async static Task<int> Main(string[] args)
|
|
{
|
|
try
|
|
{
|
|
Log.Information("Starting MicroService Applications Single Host.");
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Host.AddAppSettingsSecretsJson()
|
|
.UseAutofac()
|
|
.UseSerilog((context, provider, config) =>
|
|
{
|
|
config.ReadFrom.Configuration(context.Configuration);
|
|
});
|
|
await builder.AddApplicationAsync<MicroServiceApplicationsSingleModule>(options =>
|
|
{
|
|
// 搜索 Modules 目录下所有文件作为插件
|
|
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|
var pluginFolder = Path.Combine(
|
|
Directory.GetCurrentDirectory(), "Modules");
|
|
DirectoryHelper.CreateIfNotExists(pluginFolder);
|
|
options.PlugInSources.AddFolder(
|
|
pluginFolder,
|
|
SearchOption.AllDirectories);
|
|
});
|
|
var app = builder.Build();
|
|
await app.InitializeApplicationAsync();
|
|
await app.RunAsync();
|
|
return 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Fatal(ex, "Host terminated unexpectedly!");
|
|
Console.WriteLine("Host terminated unexpectedly!");
|
|
Console.WriteLine(ex.ToString());
|
|
return 1;
|
|
}
|
|
finally
|
|
{
|
|
Log.CloseAndFlush();
|
|
}
|
|
}
|
|
}
|
|
|