want to use serilog middleware in Webhost using belwo snippet.
WebHost.CreateDefaultBuilder(args)
.UseConfiguration(configuration)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIIS()
.UseIISIntegration()
.UseStartup()
.UseSerilog()
.Build();
Yet getting below exception as UseSerilog function is not available.
Error CS1929 ‘IWebHostBuilder’ does not contain a definition for ‘UseSerilog’ and the best extension method overload ‘SerilogHostBuilderExtensions.UseSerilog(IHostBuilder, ILogger, bool, LoggerProviderCollection)’ requires a receiver of type ‘Microsoft.Extensions.Hosting.IHostBuilder’
Commenting UseSerilog() and running with default builder throws up below exception
Application startup exception: System.InvalidOperationException: Unable to resolve service for type ‘Serilog.Extensions.Hosting.DiagnosticContext’ while attempting to activate ‘Serilog.AspNetCore.RequestLoggingMiddleware’.
consumed latest serilog nuget packages yet unable to use Serilog and WebHost in .NET 8.
Is there any alternate approach bringing up this middleware?
alternate approach bringing up this middleware?