Hi,
I just setup a new ServiceStack project. When changing the RequestLogger Plugin to use CsvRequestLogger I get the following ConfigurationErrorsException when starting the API.
Can´t I use this in IHostingStartup?
Hi,
I just setup a new ServiceStack project. When changing the RequestLogger Plugin to use CsvRequestLogger I get the following ConfigurationErrorsException when starting the API.
Can´t I use this in IHostingStartup?
You can’t access the AppHost at ASP .NET Core IOC Registration i.e. within ConfigureServices()
since it runs before the AppHost has been created so you can’t use APIs like HostContext.Config
.
You’ll only be able to access ASP .NET Core Configuration classes, e.g:
.ConfigureServices((context, services) => {
//...
new FileSystemVirtualFiles(context.HostingEnvironment.ContentRootPath)
})
Also if you haven’t already please checkout the new SQLite Request Logs which stores Request Logs in rolling monthly SQLite dbs that’s more robust and has more features than the CSV Request Logger.