Thursday, October 25, 2007

EventLog.WriteEvent in Windows Service or ASPNET

If you get this error in writting EventLog.WriteEvent in Windows Service or ASP.Net.
"The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security."

You need to create your source manually. because the process can not created for u.

To add your source manually,
Open Regedit and add your source inside.
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application".

After that you will be able to Write event log freely.

No comments: