【问题标题】:An error occurred while writing to logger(s). (Cannot open log for source '.NET Runtime'. You may not have write access.)写入记录器时发生错误。 (无法打开源“.NET 运行时”的日志。您可能没有写入权限。)
【发布时间】:2021-06-08 22:45:23
【问题描述】:

我在 .Net core 3.1 中创建了一个 Web 应用程序,并尝试使用 EF Core 访问数据库。 访问它时,我遇到了错误。奇怪的是,它以前可以工作,但在应用程序方面没有任何变化。

       at Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.LoggerMessage.<>c__DisplayClass7_0`3.<Define>g__Log|0(ILogger logger, T1 arg1, T2 arg2, T3 arg3, Exception exception)
   at Microsoft.Extensions.Logging.LoggerMessage.<>c__DisplayClass7_0`3.<Define>b__1(ILogger logger, T1 arg1, T2 arg2, T3 arg3, Exception exception)
   at Microsoft.EntityFrameworkCore.Diagnostics.EventDefinition`3.Log[TLoggerCategory](IDiagnosticsLogger`1 logger, WarningBehavior warningBehavior, TParam1 arg1, TParam2 arg2, TParam3 arg3, Exception exception)
   at Microsoft.EntityFrameworkCore.Diagnostics.CoreLoggerExtensions.QueryIterationFailed(IDiagnosticsLogger`1 diagnostics, Type contextType, Exception exception)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at System.Linq.SystemCore_EnumerableDebugView`1.get_Items()

【问题讨论】:

  • 重启机器能用吗?
  • @mjwills:不再工作了。
  • 我有同样的问题,但它是在断电后开始的。 An error occurred while migrating or initializing the database. System.AggregateException: An error occurred while writing to logger(s). (Cannot open log for source '.NET Runtime'. You may not have write access.) ---&gt; System.InvalidOperationException: Cannot open log for source '.NET Runtime'. You may not have write access. ---&gt; System.ComponentModel.Win32Exception (1722): El servidor RPC no está disponible.

标签: c# .net windows asp.net-core logging


【解决方案1】:

尝试启动 Windows 事件日志服务器enter image description here

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-27
  • 2018-07-27
  • 1970-01-01
  • 2016-11-04
相关资源
最近更新 更多