lpatnaik
Programmer
- Jul 11, 2002
- 53
Hi,
My webservice is currently deployed on WIndows 2000 server and runs pretty fine. I am trying to run my webservice on a Windows 2003 server. My webservice tries to write to a eventlog. The code is as follows:
System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog( EventLogName );
Log.Source = EventLogName;
Log.WriteEntry( "PCHistory Service Application started up successfully.", System.Diagnostics.EventLogEntryType.Information );
I am getting the following error.
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.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type)
at PCHistory.PCHistoryService.Log(String Message, EventLogEntryType type)
at PCHistory.PCHistoryService.LogInfo(String Message, Object[] args)
at PCHistory.PCHistoryService..ctor()
I tried the following:
1. Giving full rights to ASPNET account on HKLM\System\CurrentControlSet\Services\Eventlog
2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
3.Changing machine .config process model attribute of USerName to SYSTEM.
4. Creating the Source manually in the registry.
Nothing worked.
If u have solution please reply ASAP.
Thanks
LP
My webservice is currently deployed on WIndows 2000 server and runs pretty fine. I am trying to run my webservice on a Windows 2003 server. My webservice tries to write to a eventlog. The code is as follows:
System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog( EventLogName );
Log.Source = EventLogName;
Log.WriteEntry( "PCHistory Service Application started up successfully.", System.Diagnostics.EventLogEntryType.Information );
I am getting the following error.
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.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type)
at PCHistory.PCHistoryService.Log(String Message, EventLogEntryType type)
at PCHistory.PCHistoryService.LogInfo(String Message, Object[] args)
at PCHistory.PCHistoryService..ctor()
I tried the following:
1. Giving full rights to ASPNET account on HKLM\System\CurrentControlSet\Services\Eventlog
2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
3.Changing machine .config process model attribute of USerName to SYSTEM.
4. Creating the Source manually in the registry.
Nothing worked.
If u have solution please reply ASAP.
Thanks
LP