我正在尝试使用 Serilog 登录我的 .NET 项目,但我注意到错误没有写入数据库。我打开 Serilog 的 SelfLog,这是显示的错误:
2022-11-01T15:58:26.9744639Z Unable to write 1 log events to the database due to following error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
这是我在 Program.cs 中对 Serilog 的设置:
var columnOptions = new ColumnOptions();
columnOptions.Store.Remove(StandardColumn.Properties);
columnOptions.Store.Remove(StandardColumn.MessageTemplate);
columnOptions.TimeStamp.NonClusteredIndex = true;
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(Config)
.Enrich.FromLogContext()
.Enrich.WithExceptionDetails()
.WriteTo.Console() …Run Code Online (Sandbox Code Playgroud)