Security problem when writting to Event Log

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Security problem when writting to Event Log

    When trying to execute the following code in a web service, I get the
    enclosed error. Everyone has full control to the registry and Security
    System is configured with the default "Full Control" access for "All code".
    thanks a lot.

    WEBMETHOD:
    EventLog log = new EventLog("ContosoLog");
    log.Source = "MyServiceApplication";
    log.WriteEntry("My sessionID", EventLogEntryType.Warning);

    ERROR:
    System.Web.Services.Protocols.SoapException: Server was unable to process
    request. ---> System.Security.SecurityException: Requested registry access is
    not allowed. at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean
    writable) at System.Diagnostics.EventLog.FindSourceRegistration (String
    source, String machineName, Boolean readOnly) at
    System.Diagnostics.EventLog.SourceExists(String source, String machineName)
    at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
    type, Int32 eventID, Int16 category, Byte[] rawData) at
    System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
    type, Int32 eventID, Int16 category) at
    System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
    type, Int32 eventID) at System.Diagnostics.EventLog.WriteEntry(String
    message, EventLogEntryType type) at MyService.Service1.SessionID() in
    c:\inetpub\wwwroot\myservice\service1.asmx.cs:line 79 --- End of inner
    exception stack trace ---

    JMMB Guest

  2. Similar Questions and Discussions

    1. Odd security event error
      Error #2044: Unhandled SecurityErrorEvent:. text=Error #2047: Security sandbox violation: LocalConnection.send: What does this error mean??? It...
    2. Security Exception when writting to EventLog
      When trying to execute the following code in a web service, I get the enclosed error. Everyone has full control do the registry and Security System...
    3. Security Event Viewer
      In Windows XP, this is normal if you are using the Welcome Screen as opposed to traditional ctrl-alt-del logon. It gets less for Service Pack 1. ...
    4. XP Event Viewer Security Log.
      have attempts. Logon," as well as other unauthorized logons. At this point my guess is that we have a hacker(s) that have taken over our...
    5. Security Risk? Event 63
      Hello, I've got the same issue but with HiPerfCooker_v1. It is happen when I was applying the SP1 for Win XP on my Laptop after I just finish to...
  3. #2

    Default Re: Security problem when writting to Event Log

    u should give ASP.NET user required permission to write event log. adding it
    administrator group should fix it. By i think u should use local security
    policy to configure settings...

    --

    Thanks,
    Yunus Emre ALPÖZEN
    BSc, MCAD.NET

    "JMMB" <microsoft.com> wrote in message
    news:com... 


    Yunus Guest

  4. #3

    Default Re: Security problem when writting to Event Log

    "Yunus Emre ALPÖZEN [MCAD.NET]" <net> wrote in message
    news:%phx.gbl... 

    That won't actually help here.

     

    Running as an admin will fix just about any problem that's due to a
    restricted ACL. However, running ASP.NET under an admin account is usually
    a pretty terrible idea...

     

    No setting that's modifiable under the Local Security Policy MMC is relevant
    to this problem.

     
    >
    >[/ref]


    Nicole Guest

  5. #4

    Default Re: Security problem when writting to Event Log

    "JMMB" <microsoft.com> wrote in message
    news:com... 

    Not to every key in the registry, or you wouldn't be having this problem.
    <g>
     

    If by this you mean that you're running under default CAS (code access
    security) policy, that's not relevant to the exception you're seeing, which
    is due to user permissions, not CAS permissions.

    You're probably seeing this exception because the "MyServiceApplication"
    source isn't actually registered. When the framework code invoked by the
    WriteEntry method attempts to identify the log associated with the source
    (which it does even if you tell it which log to use), it's most likely
    hitting registry entries for a log with highly restricted permissions (e.g.:
    Security, or maybe ContosoLog if you haven't set its permissions
    appropriate). In order to avoid this problem, you need to create your new
    log and register the "MyServiceApplication" source while running from a more
    privileged account. One approach is to do this from your application's
    installer, which would typically be run under an admin account.

     


    Nicole Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139