P
Philip Colmer
I'm trying to set up event logging in my web service. The code is as
follows:
Const AppName = "Fred"
Dim objEventLog As New EventLog
Try
'Register the App as an Event Source
If Not objEventLog.SourceExists(AppName) Then
objEventLog.CreateEventSource(AppName, Nothing)
End If
objEventLog.Source = AppName
objEventLog.WriteEntry("Test")
LogOutcome = ""
Catch Ex As Exception
LogOutcome = Ex.ToString
End Try
I'm getting an exception at the call to CreateEventSource:
System.Security.SecurityException: Requested registry access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) at
System.Diagnostics.EventLog.CreateEventSource(String source, String logName,
String machineName, Boolean useMutex) at
System.Diagnostics.EventLog.CreateEventSource(String source, String logName,
String machineName) at System.Diagnostics.EventLog.CreateEventSource(String
source, String logName) at
QuarantineService.QuarantineValues.LogOutcome(String strUser, String
strComputer, String strOutcome)
I'm not entirely sure what to do to resolve this. The web service is running
under the default app pool.
--Philip
follows:
Const AppName = "Fred"
Dim objEventLog As New EventLog
Try
'Register the App as an Event Source
If Not objEventLog.SourceExists(AppName) Then
objEventLog.CreateEventSource(AppName, Nothing)
End If
objEventLog.Source = AppName
objEventLog.WriteEntry("Test")
LogOutcome = ""
Catch Ex As Exception
LogOutcome = Ex.ToString
End Try
I'm getting an exception at the call to CreateEventSource:
System.Security.SecurityException: Requested registry access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) at
System.Diagnostics.EventLog.CreateEventSource(String source, String logName,
String machineName, Boolean useMutex) at
System.Diagnostics.EventLog.CreateEventSource(String source, String logName,
String machineName) at System.Diagnostics.EventLog.CreateEventSource(String
source, String logName) at
QuarantineService.QuarantineValues.LogOutcome(String strUser, String
strComputer, String strOutcome)
I'm not entirely sure what to do to resolve this. The web service is running
under the default app pool.
--Philip