0

I'd like to log any Ilogger data into database in Blazor Server. So according to this video I created this repository.

When I run the project, the first page of the project is displayed for a while, but it closes suddenly. As far as I understand, the problem is from recording too much information in the database in the following section in a short time. Because when the following code is commented in log method, the problem is solved. How do I fix this problem?

_dbContext.SaveChanges();
Arani
  • 891
  • 7
  • 18
  • 1
    You should create a ConcurrentQueue for it. I have a sample of it here: https://github.com/VahidN/DNTIdentity/blob/master/src/ASPNETCoreIdentitySample.Services/Identity/Logger/DbLoggerProvider.cs#L18 – VahidN Sep 24 '22 at 07:22
  • This is exactly the answer to my question. Would you like to present it in the form of an answer? – Arani Oct 22 '22 at 10:00

0 Answers0