I have a .Net Core 3.1 project that uses Serilog and posts messages to Azure Eventhub. The problems started when we moved it to .Net 5.
Here's how it's configured in Startup.cs in ConfigureServices we have section
var eventHubConfig = Configuration.GetSection("Logging").GetSection("eventHub");
string eventHubConnection = eventHubConfig.GetValue<string>("connectionString");
Log.Logger = new LoggerConfiguration()
.WriteTo.AzureEventHub(new JsonFormatter(),
eventHubConnection.Replace(@"\", ""),
eventHubConfig.GetValue<string>("entityName"))
.CreateLogger();
in Configure method we have: loggerFactory.AddSerilog();
and in Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseSerilog()
.UseStartup<Startup>();
Very simple and it's working for .Net Core 3.1, but once I change the target framework for the project to .Net 5 it stops working.
Any thoughts? Has anyone seen the same issue?
Serilog uses an old version of Microsoft.Azure.EventHubs internally
I had the same issue and bumping to 4.3.2 solved the problem
Since then Microsoft.Azure.EventHubs have been deprecated and we have moved to Serilog 6 and Azure.Messaging.EventHubs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.