diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj
index cc6b3c2..aeaa871 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj
@@ -50,6 +50,10 @@
+
+
+
+
diff --git a/IRaCIS.Core.API/Program.cs b/IRaCIS.Core.API/Program.cs
index 3144ac3..f849c52 100644
--- a/IRaCIS.Core.API/Program.cs
+++ b/IRaCIS.Core.API/Program.cs
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Web;
+using Serilog;
namespace IRaCIS.Core.API
{
@@ -12,24 +13,11 @@ namespace IRaCIS.Core.API
{
public static void Main(string[] args)
{
- ImageManager.SetImplementation(WinFormsImageManager.Instance);
- var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
- try
- {
- logger.Debug("init main");
+ ImageManager.SetImplementation(WinFormsImageManager.Instance);
+
+
CreateHostBuilder(args).Build().Run();
- }
- catch (Exception exception)
- {
- //NLog: catch setup errors
- logger.Error(exception, "Stopped program because of exception");
- throw;
- }
- finally
- {
- // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
- NLog.LogManager.Shutdown();
- }
+
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
@@ -38,20 +26,19 @@ namespace IRaCIS.Core.API
{
webBuilder.ConfigureKestrel((context, options) =>
{
- //设置应用服务器Kestrel请求体最大为1GB // if don't set default value is: 30 MB
+ //璁剧疆搴旂敤鏈嶅姟鍣↘estrel璇锋眰浣撴渶澶т负1GB // if don't set default value is: 30 MB
options.Limits.MaxRequestBodySize = long.MaxValue;
options.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(30);
options.Limits.RequestHeadersTimeout = TimeSpan.FromMinutes(30);
});
webBuilder.UseStartup();
- })//使用Autofac替代本身容器
+ })//浣跨敤Autofac鏇夸唬鏈韩瀹瑰櫒
.UseServiceProviderFactory(new AutofacServiceProviderFactory()).
ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
- })
- .UseNLog()
+ }).UseSerilog()
; // NLog: Setup NLog for Dependency injection;
}
diff --git a/IRaCIS.Core.API/Startup.cs b/IRaCIS.Core.API/Startup.cs
index b6d2cb4..d18f4c5 100644
--- a/IRaCIS.Core.API/Startup.cs
+++ b/IRaCIS.Core.API/Startup.cs
@@ -17,6 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
+using Serilog;
using System;
using System.IO;
using System.Reflection;
@@ -114,6 +115,11 @@ namespace IRaCIS.Core.API
// options.MaxRequestBodySize = int.MaxValue;
//});
+
+ Log.Logger = new LoggerConfiguration()
+ .WriteTo.Console() // 閫夋嫨鏃ュ織杈撳嚭鐩爣锛屽彲浠ラ夋嫨鏂囦欢銆佹暟鎹簱绛
+ .CreateLogger();
+
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -162,6 +168,8 @@ namespace IRaCIS.Core.API
{
endpoints.MapControllers();
});
+
+ Log.Information("璁¤垂绯荤粺鍚姩...");
}
}
}