none
Access denied when application writing to eventlog RRS feed

  • Question

  • Hi all.

    (Hope this is the right forum)

    A web application should write to eventlog, but get this error:

    Access is denied
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ComponentModel.Win32Exception: Access is denied

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:


    [Win32Exception (0x80004005): Access is denied]

    [InvalidOperationException: Cannot open log for source 'WebAppName'. You may not have write access.]
       System.Diagnostics.EventLog.OpenForWrite(String currentMachineName) +1830063...

    Windows 2008 R2 server. Have been searching for answers all day, and have been trying out different things.
    Adding the CustomSD key: HKEY_LOCAL_MACHINE/System/CurrentControlSet/Application with the value (A;;0x0002;;;AU)

    Give everyone access to the keys:
    - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
    - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\System
    - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security

    Set the application pool to run with an admin account...

    But no luck. So how to give my application write access?


    Regards,
    Arthur

     
    Thursday, February 25, 2010 4:50 PM

Answers

  • Its not the application but the service which is running the connection pool as specified for your website/service. Look into that service, as specified in IIS, to determine if it has access rights. Either find a different service, create a new connection pool for the site, or update the default service which runs all sites to access the log.

    William Wegerson (www.OmegaCoder.Com)
    Thursday, February 25, 2010 6:41 PM
    Moderator

All replies

  • Its not the application but the service which is running the connection pool as specified for your website/service. Look into that service, as specified in IIS, to determine if it has access rights. Either find a different service, create a new connection pool for the site, or update the default service which runs all sites to access the log.

    William Wegerson (www.OmegaCoder.Com)
    Thursday, February 25, 2010 6:41 PM
    Moderator
  • Thanks for your reply.
    Do you mean application pool? Can't find anything about connection pool.
    I now use a local admin as identity for the application pool running this website.

    Arthur
    • Edited by PABerg Monday, March 1, 2010 3:07 PM
    Friday, February 26, 2010 9:06 AM
  • Thanks for your reply.
    Do you mean application pool? Can't find anything about connection pool.
    I know use a local admin as identity for the application pool running this website.

    Yes Application pool, my bad.
    William Wegerson (www.OmegaCoder.Com)
    Friday, February 26, 2010 3:19 PM
    Moderator