views:

862

answers:

1

ASP.Net 3.5 running under IIS 7 doesn't seem to allow this out of the box.

        if (!EventLog.SourceExists("MyAppLog"))
            EventLog.CreateEventSource("MyAppLog", "Application");

        EventLog myLog = new EventLog();
        myLog.Source = "MyAppLog";
        myLog.WriteEntry("Message");
+5  A: 

This is part of windows security since windows 2003.

You need to create an entry in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application Make sure that network service or the account you impersonate has permission to this registry key.

@CheGueVerra's link: Requested Registry Access Is Not Allowed

Aaron Fischer
Here's a MSDN Link http://support.microsoft.com/?id=329291
CheGueVerra
This applies to IIS6 as well
Robert Wagner