Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用模拟时写入事件日志_C#_.net_Asp.net_Event Log_Tracesource - Fatal编程技术网

C# 使用模拟时写入事件日志

C# 使用模拟时写入事件日志,c#,.net,asp.net,event-log,tracesource,C#,.net,Asp.net,Event Log,Tracesource,由于某种原因,当我在web.config中使用模拟选项时。一切正常,但有一个问题困扰着我,即使用System.Diagnostics.TraceSource写入事件日志时发生以下错误: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ComponentModel.Win32Except

由于某种原因,当我在web.config中使用模拟选项时。一切正常,但有一个问题困扰着我,即使用
System.Diagnostics.TraceSource
写入事件日志时发生以下错误:

System.Web.HttpUnhandledException (0x80004005): 
Exception of type 'System.Web.HttpUnhandledException' was thrown. 
---> System.ComponentModel.Win32Exception (0x80004005): 
Access is denied at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName) 
at System.Diagnostics.EventLogInternal.WriteEvent(EventInstance instance, Byte[] data, Object[] values) 
at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)

有人给我一些建议吗?提前感谢。

被模拟的用户没有写入事件日志的权限


我建议您使用任何用户都有写入权限的TraceListener(如目录完全打开的文件)。

被模拟的用户没有写入事件日志的权限

我建议您使用任何用户都有写访问权限的TraceListener(比如目录完全打开的文件)