Fix to "The handle is invalid" error when ASP.NET writes to the Eventlogs

Have you ever come across the error below with one of your ASP.NET web apps that is trying to write to the Eventlogs? If so, read on…


By default the ASPNET user cannot access the existing eventlogs categories. To resolve this, you must set the permissions in the Eventlog key in the registry:

  1. Launch RegEdit.
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\.
  3. From the menu, select Edit->Permissions.
  4. Click the Add button and write ASPNET (if ASP.NET is running under a different User ID, use that ID instead).
  5. Click OK.
  6. Select the newly added user from the list (ASP.NET Machine User by default).
  7. Click on Full Control in the Allow column. 8. Click OK.

More info here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.