当用户不属于ASP.Net 2008 R2和IIS7中的管理员组时,我从Windows4.0 web应用程序获得了写入应用程序事件日志的log4net权限。我们使用NT身份验证和模拟。一旦我将用户分配到admin组,它就可以正常工作。我尝试了很多权限设置,比如给经过身份验证的用户完全访问注册表中的事件日志等,但都不起作用。如果有人能帮上忙,那就太好了。
当我在Windows2003服务器上从Windows1.1应用程序中记录事件日志时遇到类似的问题时,我按照下面的链接输入CustomSD,它起作用了
http://mossipqueen.wordpress.com/2008/08/04/cannot-open-log-for-source-you-may-not-have-write-access/
下面是我从log4net内部日志中得到的错误。
log4net:ERROR [EventLogAppender] Unable to write to event log [Application] using source [*******]
System.InvalidOperationException: Cannot open log for source '*******'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at System.Diagnostics.EventLogInternal.OpenForWrite(String currentMachineName)
at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at log4net.Appender.EventLogAppender.Append(LoggingEvent loggingEvent)发布于 2011-07-09 04:56:55
也许我在这里遗漏了一些东西,但它看起来像是该用户的一个简单的权限问题。默认情况下,它们没有写入应用程序日志文件的权限。我知道你玩弄了权限,但我不确定你到底分配了什么权限。
以下是一篇Microsoft文章,介绍了如何通过执行您想要执行的操作来克服您看到的错误:
http://support.microsoft.com/kb/2028427
如果你遵循这一点,你应该解决你的问题。我希望这能帮到你。
https://stackoverflow.com/questions/6629205
复制相似问题