w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security

See creating a registry key.

This problem can occur not only due to permissions, but also due to event source key missing because it wasn't registered successfully (you need admin privileges to do it - if you just open Visual Studio as usual and run the program normally it won't be enough). Make sure that your event source "MyApp" is actually registered, i.e. that it appears in the registry under HKEY_LOCAL_MACHINESYSTEMCurrentControlSetserviceseventlogApplication.

From MSDN EventLog.CreateEventSource():

To create an event source in Windows Vista and later or Windows Server 2003, you must have administrative privileges.

So you must either run the event source registration code as an admin (also, check if the source already exists before - see the above MSDN example) or you can manually add the key to the registry:

  1. create a regkey HKEY_LOCAL_MACHINESYSTEMCurrentControlSetserviceseventlogApplicationMyApp;
  2. inside, create a string value EventMessageFile and set its value to e.g. C:WindowsMicrosoft.NETFrameworkv2.0.50727EventLogMessages.dll




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.