为什么以下代码不起作用?
if(EventLog.Exists("Foo"))
{
EventLog.Delete("Foo");
}
if(EventLog.Exists("Foo") == false)
{
EventLog.CreateEventSource("Foo", "Foo");
EventLog.GetEventLogs().First(x => x.Log == "Foo").ModifyOverflowPolicy(OverflowAction.OverwriteAsNeeded, 0);
EventLog.GetEventLogs().First(x => x.Log == "Foo").MaximumKilobytes = 100000;
}
溢出策略已正确更改,但最大大小保持在默认的 512KB。我究竟做错了什么?
谢谢!