Logging to the database with ASP.NET Core

I was reading about logging in ASP.NET when I came across this statement about logging to the database: When logging to SQL Server, don’t do so directly. Instead, add log messages to an in-memory queue and have a background worker dequeue and insert data to SQL Server. Paraphrased from Microsoft – No asynchronous logger methods … Read more

Control ASP.NET behavior when background service crashes

When a background service throws an unhandled exception in ExecuteAsync(), you have two options: You can change the behavior if the default isn’t what you want (notice the default behavior changed in .NET 6). In .NET 6+, you can configure the behavior in the initialization code. Here’s an example of making it ignore crashed background … Read more