Event Log – System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security


Event Log – System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security

This is a common error specially if you’re using Windows Server 2008 and higher, error means that the application/program that’s trying to write to event log with source not registered properly. Take the sample code below as an example:

EventLog.WriteEntry(“<Source>”,”Message”);

During the deployment you can register the source by entering the ff command in the command prompt (Run as Administrator):

eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO <Source> /D “Registering”

If for some  reason you don’t know the source is and it’s throwing the error do the following:

Start -> Run -> regedit.exe Navigate to My Computer > HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog

in the Permissions, and grant the identity wherein the application/server is running with read/write permissions.

You will see the source that you need to register in the Event Log.

Advertisements

2 thoughts on “Event Log – System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security

  1. Srikant

    Thanks for the post. I am facing exactly the same issue.
    I was trying to follow the steps you’ve mentioned but I can’t clearly understand what you meant by
    “grant the identity wherein the application/server is running with read/write permission”
    Could you please elaborate.

    Thank you,
    Srikant

  2. It’s the account (user account) wherein the application/service is running.
    If you go to Run-> services.msc .. Right click a Service name -> Properties -> then Logon Properties.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s