この例外 の取得 ファイル サイズが許可された制限を超えているため、次を使用してイベント ビューアに書き込むときに保存できませんEventLog
使用したコード:
string cs = "LoggingService";
EventLog elog = new EventLog();
if (!EventLog.SourceExists(cs))
{
EventLog.CreateEventSource(cs, cs);
}
elog.Source = cs;
elog.EnableRaisingEvents = true;
elog.WriteEntry(message);
スタックトレース:
System.ComponentModel.Win32Exception (0x80004005): The file size exceeds the limit allowed and cannot be saved
at System.Diagnostics.EventLogInternal.get_OldestEntryNumber()
at System.Diagnostics.EventLogInternal.StartRaisingEvents(String currentMachineName, String currentLogName)
at System.Diagnostics.EventLogInternal.set_EnableRaisingEvents(Boolean value)
試したこと:
- http://support.microsoft.com/kb/328380#top
このステートメントを
elog.Clear()
前に置くelog.EnableRaisingEvents = true;
と、別の例外が発生しますSystem.ComponentModel.Win32Exception (0x80004005): System.Diagnostics.EventLogInternal.Clear() でアクセスが拒否されました
上記のコードは、コンピューター上で完全なアクセス許可を持つLocalSystemで実行される Web サービスによって実行されます。
OS: Windows サーバー 2008R2 および .NET 4.0