Unable to log into event viewer using enterprise library

Apr 2, 2009 at 2:40 PM

I have created a sample application using enterprise libarary logging application block
to log into event viewer. This application is hosted under IIS with anonymous user option checked on.
It logs into the event viewer perfectly.

I have another application which user forms authentication using enterprise libarary logging application block
to log into event viewer.Even this application is hosted under IIS with anonymous user option checked on.
This application uses WCF.

while logging i am not able to log the message in the event viewer.
I tried to debug the enterprise library source code and  found the error in this location

File name is :   ...\EntLibMay2007\App Blocks\Src\Logging\LogSource.cs

method name is :public void TraceData(TraceEventType eventType, int id, LogEntry logEntry, TraceListenerFilter traceListenerFilter)
  
line :   listener.TraceData(manager, Name, eventType, id, logEntry);

The stack trace information is given below.

"   at Microsoft.Win32.RegistryKey.Win32ErrorStatic(Int32 errorCode, String str)\r\n   at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String machineName)\r\n   at System.Diagnostics.EventLog.GetEventLogRegKey(String machine, Boolean writable)\r\n   at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)\r\n   at System.Diagnostics.EventLog.SourceExists(String source, String machineName)\r\n   at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName)\r\n   at System.Diagnostics.EventLog.WriteEvent(EventInstance instance, Byte[] data, Object[] values)\r\n   at System.Diagnostics.EventLog.WriteEvent(EventInstance instance, Object[] values)\r\n   at System.Diagnostics.EventLogTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType severity, Int32 id, Object data)\r\n   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedTraceListenerWrapperBase.TraceData(TraceEventCache eventCache, String source, TraceEventType severity, Int32 id, Object data) in C:\\EnterpriseLibaray\\EntLibMay2007\\App Blocks\\Src\\Logging\\TraceListeners\\FormattedTraceListenerWrapperBase.cs:line 83\r\n   at Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter) in C:\\EnterpriseLibaray\\EntLibMay2007\\App Blocks\\Src\\Logging\\LogSource.cs:line 130"

error message : "Attempted to perform an unauthorized operation."

I have given full permissions to aspnet machine account in the registry entry at the below paths:

     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog

     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\Enterprise Library Logging

Is there any thing else i am missing .
I still wonder why my sample application is able to log and the second application is unable to log into event viewer.